onLabelCreated( )


Triggered when a label is created.

Method Declaration
Copy
function wixContacts_onLabelCreated(event: LabelCreated): void;
Method Parameters
eventLabelCreated

Information about the task that was created and metadata for the event.

An event fired when a label is created
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 wixContacts_onLabelCreated(event) { const eventId = event.metadata.id; const entityId = event.entity._id; const displayName = event.entity.displayName; console.log("Label created", event); } /* Full event object: * { * "metadata": { * "id": "fee55184-82f3-47ba-bd53-fdbb5c7faf7a", * "entityId": "custom.customer-group-3", * "eventTime": "2024-01-11T12:36:09.707620304Z", * "triggeredByAnonymizeRequest": false * }, * "entity": { * "namespace": "custom", * "namespaceDisplayName": "Labels", * "key": "custom.customer-group-3", * "displayName": "Customer Group 3", * "labelType": "USER_DEFINED", * "legacyId": "222e7d37-9795-45e2-a6ef-58a40981a43c", * "_createdDate": "2024-01-11T12:36:09.702Z", * "_updatedDate": "2024-01-11T12:36:09.702Z" * } * } */
Errors

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

Did this help?