// Logs the label for all the address fields associated with contact// 'John Doe'. This method can be similarly called for any field that has// a label.constcontacts=ContactsApp.getContactsByName('John Doe');constaddressFields=contacts[0].getAddresses();for(leti=0;i < addressFields.length;i++){Logger.log(addressFields[i].getLabel());}
// Sets the label to 'Apartment' for the first address field associated// with contact 'John Doe'. This method can be similarly called for any// field that has a label.constcontacts=ContactsApp.getContactsByName('John Doe');constaddressFields=contacts[0].getAddresses();addressFields[0].setLabel('Apartment');
// Logs the value of all the custom fields for contact 'John Doe'constcontacts=ContactsApp.getContactsByName('John Doe');constfields=contacts[0].getCustomFields();for(constiinfields){Logger.log(fields[i].getValue());}
// Sets the first custom field associated with contact 'John Doe' to use 'Mail// application' as a label, with 'Gmail' as the value.constcontacts=ContactsApp.getContactsByName('John Doe');constfield=contacts[0].getCustomFields()[0];field.setLabel('Mail application');field.setValue('Gmail');
// Sets the first custom field associated with contact 'John Doe' to use 'Mail// application' as a label, with 'Gmail' as the value.constcontacts=ContactsApp.getContactsByName('John Doe');constfield=contacts[0].getCustomFields()[0];field.setLabel('Mail application');field.setValue('Gmail');
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2024-12-22 UTC"],[[["`CustomField` is deprecated and the People API advanced service should be used instead."],["It represents a custom field within a Contact and previously allowed for getting, setting, and deleting custom field data."],["`getLabel()` and `setLabel(label)` methods remain available for retrieving and setting the label of a custom field."],["Several methods, including `deleteCustomField()`, `getValue()`, `setLabel(field)`, and `setValue(value)`, are deprecated and should no longer be used."]]],["The `CustomField` in the Contacts API is deprecated in favor of the People API. It allows interacting with a custom field in a contact, using `getLabel()` to retrieve the field's label and `setLabel(label)` to change it. Deprecated methods include `deleteCustomField()` to remove the field, `getValue()` to get the field's value, `setLabel(field)` to set a label, and `setValue(value)` to assign the field's value. These actions require specific authorization scopes.\n"]]