Search...
onLabelCreated( )
Developer Preview
An event that triggers when a new label is created.
Description
The onLabelCreated()
event handler runs when a new label is created. The received LabelCreated
object contains information about the label that was created.
Note: Backend events don't work when previewing your site.
Syntax
function wixContacts_onLabelCreated(event: LabelCreated): void
onLabelCreated Parameters
NAME
TYPE
DESCRIPTION
event
Optional
LabelCreated
Information about the task that was created and metadata for the event.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event fired when a label is created
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 wixContacts_onLabelCreated(event) {6 const eventId = event.metadata.id;7 const entityId = event.entity._id;8 const displayName = event.entity.displayName;9 console.log('Label created', event);10}1112/* Full event object:13 * {14 * "metadata": {15 * "id": "fee55184-82f3-47ba-bd53-fdbb5c7faf7a",16 * "entityId": "custom.customer-group-3",17 * "eventTime": "2024-01-11T12:36:09.707620304Z",18 * "triggeredByAnonymizeRequest": false19 * },20 * "entity": {21 * "namespace": "custom",22 * "namespaceDisplayName": "Labels",23 * "key": "custom.customer-group-3",24 * "displayName": "Customer Group 3",25 * "labelType": "USER_DEFINED",26 * "legacyId": "222e7d37-9795-45e2-a6ef-58a40981a43c",27 * "_createdDate": "2024-01-11T12:36:09.702Z",28 * "_updatedDate": "2024-01-11T12:36:09.702Z"29 * }30 * }31 */32