A backend event that fires when a Policy is updated.
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.
function wixEvents_onPolicyUpdated(event: PolicyUpdated): void;
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixEvents_onPolicyUpdated(event) {
const eventId = event.metadata.id;
const entityId = event.entity._id;
}
/* Full policy object:
{
"metadata": {
"id": "76d05dfc-15bd-4203-b9b4-64d82edc833c",
"entityId": "52f15c5c-ea06-44f4-866a-b1cfa6f4f790",
"eventTime": "2023-03-08T11:31:57.454388Z",
"triggeredByAnonymizeRequest": false
},
"entity": {
"_id": "52f15c5c-ea06-44f4-866a-b1cfa6f4f790",
"revision": "4",
"_createdDate": "2023-03-07T14:15:44.312Z",
"_updatedDate": "2023-03-08T11:31:57.443Z",
"name": "Terms and Conditions Event 1",
"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.",
"eventId": "3d3d5c04-ece0-45a8-85f0-11a58edaa192"
}
}
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.