Data Structure

The CloudSponge Widget uses an array of Contact objects to represent a user’s address book. This data structure is most commonly used by developers who implement the beforeDisplayContacts() and afterSubmitContacts() callbacks since it’s passed in as an argument there.

PropertiesDescription
contact.first_nameThe contact’s first name.
contact.last_nameThe contact’s last name.
contact.emailAn array of Email objects for the contact.
contact.email[i].addressThe email address.
contact.email[i].typeThe type associated with the email. Possible values depend on the address book source.
contact.phoneAn array of Phone objects for the contact.
contact.phone[i].numberThe phone number.
contact.phone[i].typeThe type associated with the phone number. Possible values depend on the address book source.
contact.addressundefined or an array of Address objects for the contact. Each address has the properties: address and type.
contact.address[i].formattedundefined or the full mailing address, formatted with line breaks (\n).
contact.address[i].streetThe street portion of the mailing address.
contact.address[i].cityThe city portion of the mailing address.
contact.address[i].regionThe state or province portion of the mailing address.
contact.address[i].countryThe city portion of the mailing address.
contact.address[i].postal_codeThe zip or postal code portion of the mailing address.
contact.address[i].typeThe type associated with the mailing address. Possible values depend on the address book source.
contact.job_titleThe job title, if any is associated with the contact.
contact.companiesAn array of strings representing the companies that the contact is associated with, when available.
contact.groupsAn array of strings representing the groups that the contact is associated with, when available. The groups are defined by the owner of the addres book.
contact.dobA string representing the date of birth of the contact, if available. The date format is YYYY-MM-DD.
contact.birthdayA string representing the month and day of the contact’s birthday, if available. The format is MM-DD.
FunctionsUsage
contact.fullName()Returns a string with the first and last name for the contact joined with a space.
contact.primaryEmail()Returns a string with the primary email address for the contact.
contact.selectedEmail()Returns a string with the email address that was selected in a drop down list. If the Choose Contacts page was not displayed, it returns the value of contact.primaryEmail().