In general, the task from the table to create a contact in Google, but in the official manual ( https://developers.google.com/apps-script/reference/contacts/ ) did not find a method for adding or editing the middle name field, additional Name. Prompt, it is generally possible within the framework of the script. that's what I have already written:

function addCont(contact,G1,G2) { var cont = ContactsApp.createContact(contact.NAME[1], contact.NAME[0], contact.MAIL); cont.addToGroup(G1); cont.addToGroup(G2); cont.addCompany(contact.KORP,""); if (contact.KORP==contact.NAME[0]){ contact.KORP = ""; }else{ contact.KORP = " (" + contact.KORP + ")"; cont.setSuffix(contact.KORP.replace(" (","(")); } cont.setFullName(contact.NAME[1] + " " + contact.NAME[2] + " " + contact.NAME[0] + contact.KORP); cont.addPhone(ContactsApp.Field.MOBILE_PHONE, contact.PHON); } 

if use

 cont.addCustomField("Additional Name", contact.NAME[2]); 

then he makes a separate entry in the custom field, and less is needed for him to enter data into the variable intended for this, it is provided by Google contacts, Unload contact

but how to make a record there, until I found it, otherwise the phone displays the contact is not correct.

    2 answers 2

    As far as I understand, there is no such thing as additionalName in the standard list of fields and in the extended list of fields . There is only MiddleName. As I understand it, this is due to the fact that many Western countries have no patronymic names - only " middle " names, which can even be given several at birth. Therefore, you can use this field for middle names. If you want the middle name as additionalName, then use addCustomField :

    Extended or custom label. The label can be either from ContactsApp.ExtendedField or a custom label string.

    That is, you can set your own field name.

    • I tried it, but it records in the wrong form, in the question I clarified what happens - Pavel Sergeevich
    • That's why I wrote, use MiddleName for this purpose - Sergey Pryanichkin
    • Thanks helped - Pavel Sergeevich
    • I agree that it’s better to use ContactsApp.Field.MIDDLE_NAME . It is correctly displayed in phones - oshliaer

    By the method of scientific typing, I found out that the middleName and the additionalName field are answered by the MiddleName solution: cont.setMiddleName(contact.NAME[2]);