Constructors
Customer()
Methods
addEmail(String,Integer,Integer)
Adds an email to a customer.Commonly used in database integrations.Use addEmail(String,Integer,Integer,Integer) to provide the external sorting rank.
addEmail(String,Integer,Integer,Integer)
Adds an email to a customer with the external sorting rank.Commonly used in database integrations.
checkFieldRights(String,String)
Checks if the current user has access to the field.checkTableRights(String)
Use this function to see if the current user has access to this customer.findExternallyFromEmail(String)
Finds an entry in the external database based on an email address.It will search all external data sources for a Customer matching the given email address. If an entry is found, a proxy entry is created and saved.Use findExternallyFromEmail(String,Integer) to provide an extTable ID to limit the search to 1 data source.
findExternallyFromEmail(String,Integer)
Finds an entry in the external database based on an email address and an extTable ID to limit the search to one data source.It will search all external data sources for a Customer matching the given email address. If an entry is found, a proxy entry is created and saved.
findExternallyFromKey(Integer,String)
Finds an external entry based on its primary key and table ID.Searches for and possibly creates a proxy entry for an external entry based on the external table (implicitly defines data source), and the primary key.If an proxy entry already exists, it is loaded. If not, the given external data source is searched, and if an entry is found, a local proxy entry is created and saved.
findFromAgentAndKey(Integer,String)
Finds a customer entry in the database based on the given agent ID and external key.findFromCellphone(String)
Finds an entry based on the cellphone.findFromEmail(String)
Find a Customer instance based on the email address.getValue(String)
Returns the value of the given field of the customer.Available fields:
- id
- name The name of the customer.
- firstname
- lastname
- phone
- cellphone
- note
- username: This is the username used for the external web.
- password: This field is deprecated from v10.2.5. Empty string will be returned. Use authenticateCustomer() instead.
- email: A list of all email addresses.
- mainEmail: The main email address.
- language: The name, languagecode or ID of the customers language.
- deleted
- company: The ID of the related company
- display_company: The value showing the name of the related company.
- dbi_agent_id
- dbi_key
- dbi_last_modified
- dbi_last_syncronized These values are for database integration
- priority: The id or name of the customers priority.
- our_contact: The username, loginname or ID of the related contact (user).
- x_*: The extrafield with the given database field name.[extra field] The extrafield with the given name (for example, “Country”).
load(Integer)
Loads the customer with the given ID.loadFromAgentAndKey(Integer,String)
Loads a customer based on agent id and external key.Loading might overwriting existing values.
login()
Creates a valid login session for the current customer.Use getValue(“loginSessionKey”) to get the actual session key created.Use logout() to kill the session.
logout()
Logs out a customer.makeSalutation()
Creates a salutation greeting the customer.Can be used in the beginning of a document or email.
removeEmail(String)
Removes the email address from the customer.For the action to take place, you must save().
removeExternalEmails(Integer,Integer)
Removes all external emails from a given source (extTable).Used with set() to make sure emails deleted from the external source is deleted.
save()
Saves a customer. If ID is set, the customer will be updated. Otherwise, a new customer entry will be created.Use save(String) to provide the source key of the StoreAndProcess consent.
save(String)
Saves a customer with the source key of the StoreAndProcess consent. If ID is set, the customer will be updated. Otherwise, a new customer entry will be created.setValue(String,String)
Sets the given field with the given value.Available fields:
- name or display_name: The name of the customer.
- firstname
- lastname
- title (From 7.x)
- mrmrs (From 7.x)
- year_of_birth (From 7.x)
- month_of_birth (From 7.x)
- day_of_birth (From 7.x)
- birth_date (From 7.x)
- person_number (From 7.x)
- post1 (From 7.x)
- post2 (From 7.x)
- post3 (From 7.x)
- salutation (From 7.x)
- middleName (From 7.x)
- phone
- direct/formattedNumber: Same as phone(From 7.x)
- phone/formattedNumber: Same as phone (From 7.x)
- cellphone
- mobile/formattedNumber: Same as cellphone (From 7.x)
- note
- infoText: Same as note. (From 7.x)
- username: This is the usedname used for the external web.
- password: This is the password used for the external web.
- email or display_email: Adds an email to the customer (does not erase existing ones).
- company: The ID of the related company
- display_company: The value showing the name of the related company.
- deleted
- dbi_agent_id
- dbi_key
- dbi_last_modified
- dbi_last_syncronized: These values are for database integration
- priority or priority_id: The id or name of the customers priority.
- language: The name, languagecode or ID of the customers language.
- ourContact: The username, loginname or ID of the related contact (user).
- x_* The extrafield with the given database field name.
- [extra field] The extrafield with the given name (for example, “Country”).
toParser(Parser)
Fills a Parser object with a Customer’s values, including extra fields. The fields are prefixed with “customer.”.Consecutive calls will overwrite (rather than append) the values in the Parser instance.