Search...
onPolicyCreated( )
A backend event that fires when a Policy is created.
Description
The onPolicyCreated()
event handler runs when a Policy is created in your site. The received PolicyCreated
object contains information about the new policy.
Note: Backend events are not fired when previewing your site.
Syntax
function wixEvents_onPolicyCreated(event: PolicyCreated): void
onPolicyCreated Parameters
NAME
TYPE
DESCRIPTION
event
Optional
PolicyCreated
Information about the created policy and onPolicyCreated
event.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
A backend event that occurs when a policy 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.45 export function wixEvents_onPolicyCreated(event) {6 const eventId = event.metadata.id7 const entityId = event.entity._id;8 }910/* Full policy object:11{12 "metadata": {13 "id": "f3d62dd6-db0c-445a-9bd5-aa0e0e06cd44",14 "entityId": "370ee789-5a2d-4e48-b2cf-adaf8a54c52e",15 "eventTime": "2023-03-08T11:04:53.171829Z",16 "triggeredByAnonymizeRequest": false17 },18 "entity": {19 "_id": "370ee789-5a2d-4e48-b2cf-adaf8a54c52e",20 "revision": "1",21 "_createdDate": "2023-03-08T11:04:53.166Z",22 "_updatedDate": "2023-03-08T11:04:53.166Z",23 "name": "Terms and Conditions Event 1",24 "body": "Tickets to this Event are issued on behalf of the Organiser and are subject to the following terms and conditions.",25 "eventId": "9d720f99-1b5a-4141-9877-d32985391e18"26 }27}28*/