Search.../

onLabelUpdated( )

Developer Preview

An event that triggers when a label is updated.

Description

The onLabelUpdated() event handler runs when a label is updated. The received LabelUpdated object contains information about the label that was updated.

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

Syntax

function wixContacts_onLabelUpdated(event: LabelUpdated): void

onLabelUpdated Parameters

NAME
TYPE
DESCRIPTION
event
Optional
LabelUpdated

Information about the task that was updated 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 updated

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_onLabelUpdated(event) {
7 const eventId = event.metadata.id;
8 const entityId = event.entity._id;
9 const displayName = event.entity.displayName;
10 console.log('Label updated', event);
11}
12
13/* Full event object:
14 * {
15 * "metadata": {
16 * "id": "a830a129-81af-47ed-b604-4e0f13ccb4cb",
17 * "entityId": "custom.customer-group-3",
18 * "eventTime": "2024-01-11T12:41:47.979883060Z",
19 * "triggeredByAnonymizeRequest": false
20 * },
21 * "entity": {
22 * "namespace": "custom",
23 * "namespaceDisplayName": "Labels",
24 * "key": "custom.customer-group-3",
25 * "displayName": "Customer Group No. 3",
26 * "labelType": "USER_DEFINED",
27 * "legacyId": "222e7d37-9795-45e2-a6ef-58a40981a43c",
28 * "_createdDate": "2024-01-11T12:36:10.000Z",
29 * "_updatedDate": "2024-01-11T12:41:48.000Z"
30 * }
31 * }
32 */