onContactUpdated( )


Triggered when a contact is updated.

Method Declaration
Copy
function wixCrm_onContactUpdated(event: ContactUpdated): void;
Method Parameters
eventContactUpdated

Information about the contact that was updated and metadata for the event.

An event fired when a contact is updated
JavaScript
// Place this code in the events.js file // of your site's Backend section. // Add the file if it doesn't exist. export function wixCrm_onContactUpdated(event) { const eventId = event.metadata.id; const entityId = event.entity._id; const lastName = event.entity.info.name.last; } /* Full event object: * { * "metadata": { * "id": "7bdca23b-a89c-48a1-be76-6dcf46fc4edb", * "entityId": "beeb8dc1-93d6-49f3-9389-18a9997f554f", * "eventTime": "2024-01-10T11:28:27.479909037Z", * "triggeredByAnonymizeRequest": false * }, * "entity": { * "_id": "beeb8dc1-93d6-49f3-9389-18a9997f554f", * "revision": 2, * "source": { * "sourceType": "ADMIN" * }, * "_createdDate": "2024-01-10T10:30:27.447Z", * "_updatedDate": "2024-01-10T11:28:27.447Z", * "primaryInfo": { * "email": "fforte@example.com", * "phone": "646-446-4789" * }, * "lastActivity": { * "activityDate": "2024-01-10T11:28:27.446Z", * "activityType": "CONTACT_UPDATED" * }, * "info": { * "name": { * "first": "Franky", * "last": "Forte" * }, * "emails": [ * { * "tag": "UNTAGGED", * "email": "fforte@example.com", * "primary": true, * "_id": "c27570d4-fc36-4391-aeb4-216b65ebb5e9" * } * ], * "phones": [ * { * "tag": "MOBILE", * "countryCode": "US", * "phone": "646-446-4789", * "e164Phone": "+16464464789", * "formattedPhone": "+1 646-446-4789", * "primary": true, * "_id": "412ccdb6-b5de-441f-ad9f-a32637357c98" * }, * { * "tag": "WORK", * "countryCode": "US", * "phone": "718-250-2680", * "e164Phone": "+17182502680", * "formattedPhone": "+1 718-250-2680", * "primary": false, * "_id": "90148d5d-4940-4761-9a30-6c677c92fa3e" * } * ], * "addresses": [ * { * "_id": "19d2ab15-0c8e-4f2c-894a-eddaba1088cf", * "tag": "BILLING", * "address": { * "formatted": "82 Howard Ave\nNew York, New York 11598\nUnited States", * "subdivision": "US-NY", * "city": "New York", * "country": "US", * "postalCode": "11598", * "addressLine1": "82 Howard Ave" * } * } * ], * "labelKeys": [ * "contacts.customers" * ], * "extendedFields": { * "invoices.vatId": "", * "contacts.displayByFirstName": "Franky Forte", * "contacts.displayByLastName": "Forte Franky" * } * } * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?