Search...
onContactDeleted( )
Developer Preview
An event that triggers when a contact is deleted.
Description
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.
Syntax
function wixCrm_onContactDeleted(event: ContactDeleted): void
onContactDeleted Parameters
NAME
TYPE
DESCRIPTION
event
Optional
ContactDeleted
Metadata for the event.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event fired when a contact is deleted
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.3// Add the file if it doesn't exist.45export function wixCrm_onContactDeleted(event) {6 const contactId = event.metadata.entityId;7 console.log('Contact deleted', event);8}910/* Full event object:11 * {12 * "metadata": {13 * "id": "e252a78d-bd95-4aa2-b65f-91730da186fa",14 * "entityId": "custom.customer-group-3",15 * "eventTime": "2024-01-11T12:47:31.862945419Z",16 * "triggeredByAnonymizeRequest": false17 * }18 * }19 */2021