Search.../

onPolicyUpdated( )

A backend event that fires when a Policy is updated.

Description

The onPolicyUpdated() event handler runs when a Policy is updated in your site. The received PolicyUpdated object contains information about the updated policy.

Note: Backend events are not fired when previewing your site.

Syntax

function wixEvents_onPolicyUpdated(event: PolicyUpdated): void

onPolicyUpdated Parameters

NAME
TYPE
DESCRIPTION
event
Optional
PolicyUpdated

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

A backend event that occurs when a policy is updated

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixEvents_onPolicyUpdated(event) {
6 const eventId = event.metadata.id
7 const entityId = event.entity._id;
8 }
9
10/* Full policy object:
11{
12 "metadata": {
13 "id": "76d05dfc-15bd-4203-b9b4-64d82edc833c",
14 "entityId": "52f15c5c-ea06-44f4-866a-b1cfa6f4f790",
15 "eventTime": "2023-03-08T11:31:57.454388Z",
16 "triggeredByAnonymizeRequest": false
17 },
18 "entity": {
19 "_id": "52f15c5c-ea06-44f4-866a-b1cfa6f4f790",
20 "revision": "4",
21 "_createdDate": "2023-03-07T14:15:44.312Z",
22 "_updatedDate": "2023-03-08T11:31:57.443Z",
23 "name": "Terms and Conditions Event 1",
24 "body": "If the Event is rescheduled, changed, moved or cancelled the Organiser cannot be held responsible for any resulting costs you may incur for travel, accommodation and other related goods, services or compensation.",
25 "eventId": "3d3d5c04-ece0-45a8-85f0-11a58edaa192"
26 }
27}
28*/