Company field in a Contact.
Methods
Method | Return type | Brief description |
---|---|---|
deleteCompanyField() | void | Deletes this company field. |
getCompanyName() | String | Gets the company name. |
getJobTitle() | String | Gets the job title. |
isPrimary() | Boolean | Gets whether this is the primary company. |
setAsPrimary() | CompanyField | Sets this company as the primary company, and unsets whatever company was previously primary. |
setCompanyName(company) | CompanyField | Sets the company name. |
setJobTitle(title) | CompanyField | Sets the job title. |
Detailed documentation
deleteCompanyField()
Deletes this company field.
// Deletes the first company associated with contact 'John Doe' var contacts = ContactsApp.getContactsByName('John Doe'); var company = contacts[0].getCompanies()[0]; company.deleteCompanyField();
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.google.com/m8/feeds
getCompanyName()
Gets the company name.
// Logs company name for all companies associated with contact 'John Doe' var contacts = ContactsApp.getContactsByName('John Doe'); var companies = contacts[0].getCompanies(); for (var i in companies) { Logger.log(companies[i].getCompanyName()); }
Return
String
— the name of the company
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.google.com/m8/feeds
getJobTitle()
Gets the job title.
// Logs job title for all companies associated with contact 'John Doe' var contacts = ContactsApp.getContactsByName('John Doe'); var companies = contacts[0].getCompanies(); for (var i in companies) { Logger.log(companies[i].getJobTitle()); }
Return
String
— the job title
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.google.com/m8/feeds
isPrimary()
Gets whether this is the primary company.
// Logs true or false depending on whether each company is the primary // company for contact 'John Doe' var contacts = ContactsApp.getContactsByName('John Doe'); var companies = contacts[0].getCompanies(); for (var i in companies) { Logger.log(companies[i].isPrimary()); }
Return
Boolean
— whether this is primary
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.google.com/m8/feeds
setAsPrimary()
Sets this company as the primary company, and unsets whatever company was previously primary.
// Sets the first company associated with contact 'John Doe' as primary var contacts = ContactsApp.getContactsByName('John Doe'); var company = contacts[0].getCompanies()[0]; company.setAsPrimary();
Return
CompanyField
— this company field, useful for chaining
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.google.com/m8/feeds
setCompanyName(company)
Sets the company name.
// Sets the company name for the first company associated with contact 'John Doe' var contacts = ContactsApp.getContactsByName('John Doe'); var company = contacts[0].getCompanies()[0]; company.setCompanyName('ACME Corp');
Parameters
Name | Type | Description |
---|---|---|
company | String | the new name for the company |
Return
CompanyField
— this company field, useful for chaining
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.google.com/m8/feeds
setJobTitle(title)
Sets the job title.
// Sets the job title for the first company associated with contact 'John Doe' var contacts = ContactsApp.getContactsByName('John Doe'); var company = contacts[0].getCompanies()[0]; company.setJobTitle('Manager');
Parameters
Name | Type | Description |
---|---|---|
title | String | the new job title for the contact at this company |
Return
CompanyField
— this company field, useful for chaining
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.google.com/m8/feeds