onContactDeleted( )


An event that triggers when a contact is deleted.

The onContactDeleted() event handler runs when a contact is deleted. The received ContactDeletedEvent object contains event metadata.

If a contact is deleted as part of a merge, metadata.originatedFrom is sent as "merge". Otherwise, originatedFrom is omitted.

Note: Backend events don't work when previewing your site.

Method Declaration
Copy
function onContactDeleted(event: ContactDeletedEvent): void;
Method Parameters
eventContactDeletedEventRequired

Metadata for the event.

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_onContactDeleted(event) { const contactId = event.metadata.entityId; console.log("Contact deleted", event); } /* Full event object: * { * "metadata": { * "id": "225bb629-4813-4c58-91ec-07aa5fbf069c", * "entityId": "ab1b7f0f-fd39-45ac-b13b-cb02c93b5e50", * "eventTime": "2021-02-10T19:18:03.442207Z", * "triggeredByAnonymizeRequest": false * } * } */
Errors

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

Did this help?