Class CustomField
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Metode yang tidak digunakan lagi
Dokumentasi mendetail
getLabel()
Mendapatkan label untuk kolom ini. Ini dapat berupa Kolom, ExtendedField, atau String.
// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const addressFields = contacts[0].getAddresses();
for (let i = 0; i < addressFields.length; i++) {
Logger.log(addressFields[i].getLabel());
}
Pulang pergi
Object — label untuk kolom ini
Otorisasi
Skrip yang menggunakan metode ini memerlukan otorisasi dengan satu atau beberapa cakupan berikut:
-
https://www.google.com/m8/feeds
setLabel(label)
Menetapkan label kolom ini.
// 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.
const contacts = ContactsApp.getContactsByName('John Doe');
const addressFields = contacts[0].getAddresses();
addressFields[0].setLabel('Apartment');
Parameter
| Nama | Jenis | Deskripsi |
label | String | label baru untuk kolom ini |
Pulang pergi
CustomField — kolom ini, berguna untuk membuat rantai
Otorisasi
Skrip yang menggunakan metode ini memerlukan otorisasi dengan satu atau beberapa cakupan berikut:
-
https://www.google.com/m8/feeds
Metode yang tidak digunakan lagi
deleteCustomField()
Tidak digunakan lagi. Fungsi ini tidak digunakan lagi dan tidak boleh digunakan dalam skrip baru.
Menghapus kolom ini.
const contacts = ContactsApp.getContactsByName('John Doe');
const fields = contacts[0].getCustomFields();
for (let i = 0; i < fields.length; i++) {
if (fields[i].getLabel() === 'foo') {
fields[i].deleteCustomField();
}
}
Otorisasi
Skrip yang menggunakan metode ini memerlukan otorisasi dengan satu atau beberapa cakupan berikut:
-
https://www.google.com/m8/feeds
getValue()
Tidak digunakan lagi. Fungsi ini tidak digunakan lagi dan tidak boleh digunakan dalam skrip baru.
Mendapatkan nilai kolom.
// Logs the value of all the custom fields for contact 'John Doe'
const contacts = ContactsApp.getContactsByName('John Doe');
const fields = contacts[0].getCustomFields();
for (const i in fields) {
Logger.log(fields[i].getValue());
}
Pulang pergi
Object — nilai yang disimpan di kolom
Otorisasi
Skrip yang menggunakan metode ini memerlukan otorisasi dengan satu atau beberapa cakupan berikut:
-
https://www.google.com/m8/feeds
setLabel(field)
Tidak digunakan lagi. Fungsi ini tidak digunakan lagi dan tidak boleh digunakan dalam skrip baru.
Menetapkan label kolom ini.
// Sets the first custom field associated with contact 'John Doe' to use 'Mail
// application' as a label, with 'Gmail' as the value.
const contacts = ContactsApp.getContactsByName('John Doe');
const field = contacts[0].getCustomFields()[0];
field.setLabel('Mail application');
field.setValue('Gmail');
Parameter
Pulang pergi
CustomField — kolom ini, berguna untuk membuat rantai
Otorisasi
Skrip yang menggunakan metode ini memerlukan otorisasi dengan satu atau beberapa cakupan berikut:
-
https://www.google.com/m8/feeds
setValue(value)
Tidak digunakan lagi. Fungsi ini tidak digunakan lagi dan tidak boleh digunakan dalam skrip baru.
Menetapkan nilai kolom ini.
// Sets the first custom field associated with contact 'John Doe' to use 'Mail
// application' as a label, with 'Gmail' as the value.
const contacts = ContactsApp.getContactsByName('John Doe');
const field = contacts[0].getCustomFields()[0];
field.setLabel('Mail application');
field.setValue('Gmail');
Parameter
| Nama | Jenis | Deskripsi |
value | Object | nilai baru |
Pulang pergi
CustomField — kolom ini, berguna untuk membuat rantai
Otorisasi
Skrip yang menggunakan metode ini memerlukan otorisasi dengan satu atau beberapa cakupan berikut:
-
https://www.google.com/m8/feeds
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[],["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"]]