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

ParameterDb fieldDescription
firstnamefirstnameThe first name of the person
lastnamelastnameThe last name of the person
titletitleTitle
person_numberperson_numberAlphanumeric ID
phonephonePhone number
username
password
For the external web
emailEmail1 or more
companycontactThe ID of the related company
priorityticketPriorityIdThe ID of the customer’s priority
languagecust_langThe ID of the default customer language for this company.
NULL or -1 if not set.

Connected persons

ParameterDb fieldDescription
ourContactassociate_idThe ID (ejuser.id) or username of the internal employee handling sale to this company
supportAssociateIdsupportAssociateIdThe ID (ejuser.id) or username of the internal employee handling support to this company

For a complete list of fields, see the database reference.