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
2// Place this code in the events.js file
3// of your site's Backend section.
4// Add the file if it doesn't exist.
5
6export function wixContacts_onLabelCreated(event) {
7 const eventId = event.metadata.id;
8 const entityId = event.entity._id;
9 const displayName = event.entity.displayNAme;
10 console.log('Label created', event);
11}
12
13/* Full event object:
14 * {
15 * "metadata": {
16 * "id": "fee55184-82f3-47ba-bd53-fdbb5c7faf7a",
17 * "entityId": "custom.customer-group-3",
18 * "eventTime": "2024-01-11T12:36:09.707620304Z",
19 * "triggeredByAnonymizeRequest": false
20 * },
21 * "entity": {
22 * "namespace": "custom",
23 * "namespaceDisplayName": "Labels",
24 * "key": "custom.customer-group-3",
25 * "displayName": "Customer Group 3",
26 * "labelType": "USER_DEFINED",
27 * "legacyId": "222e7d37-9795-45e2-a6ef-58a40981a43c",
28 * "_createdDate": "2024-01-11T12:36:09.702Z",
29 * "_updatedDate": "2024-01-11T12:36:09.702Z"
30 * }
31 * }
32 */
33