Create and update customers
Void setValue(String field, String value)
Sets a named field to the given value. Look up names in the reference section down below, or check out the class reference.
🛈 Note
Both parameters are strings! Remember to use quotes even for IDs.
Customer c;
c.setValue("name", "John");
c.save();
Void removeEmail(String email)
Removes the email address from the customer.
🛈 Note
You must call
save() to do the action.Customer c;
c.load(4);
c.removeEmail(duplicate@superoffice.com");
c.save();
Integer save()
Saves a new or updated customer and returns its ID.
- If the ID is set before calling
save(), it’s an update. - If the ID is empty, it’s a create.
Customer c;
c.setValue("firstname", "Sarah");
printLine(c.save().toString());
Integer save(String p_gdprSourceKey)
A variant of save() that includes the source key for the StoreAndProcess consent. These keys can be found in the consent system.
Reference
Frequently used values
| Parameter | Db field | Description |
|---|---|---|
| firstname | firstname | The first name of the person |
| lastname | lastname | The last name of the person |
| title | title | Title |
| person_number | person_number | Alphanumeric ID |
| phone | phone | Phone number |
| username password | For the external web | |
| 1 or more | ||
| company | contact | The ID of the related company |
| priority | ticketPriorityId | The ID of the customer’s priority |
| language | cust_lang | The ID of the default customer language for this company. NULL or -1 if not set. |
Connected persons
| Parameter | Db field | Description |
|---|---|---|
| ourContact | associate_id | The ID (ejuser.id) or username of the internal employee handling sale to this company |
| supportAssociateId | supportAssociateId | The ID (ejuser.id) or username of the internal employee handling support to this company |
For a complete list of fields, see the database reference.