> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: updatePolicy(_id: string, policy: UpdatePolicy, options: UpdatePolicyOptions) # Method package: wixEventsV2 # Method menu location: wixEventsV2 --> policies --> updatePolicy # Method Link: https://dev.wix.com/docs/velo/apis/wix-events-v2/policies/update-policy.md # Method Description: Updates a policy. The `updatePolicy()` function returns a Promise that resolves to the newly-updated policy. Each time the policy is updated, `revision` increments by 1. The existing `revision` must be included when updating the policy. This ensures you're working with the latest policy and prevents unintended overwrites. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Update Policy (dashboard page code) ```javascript import { policies } from 'wix-events.v2'; // define policy ID and policy object to update const id = '52f15c5c-ea06-44f4-866a-b1cfa6f4f790'; const policy = { 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.', revision: '2', eventId: '3d3d5c04-ece0-45a8-85f0-11a58edaa192' }; // update policy async function elevatedUpdatePolicyFunction(){ const elevatedUpdatePolicy = wixAuth.elevate(policies.updatePolicy); try { const result = await elevatedUpdatePolicy(id, policy); return result; } catch (error) { console.error(error); // Handle the error } }; /* Returns a promise that resolves to the updated policy. { "_id": "52f15c5c-ea06-44f4-866a-b1cfa6f4f790", "revision": "3", "_createdDate": "2023-03-07T14:15:44.312Z", "_updatedDate": "2023-03-07T14:51:52.994Z", "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" } */ ``` ## Update Policy (export from backend code) ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { policies } from 'wix-events.v2'; import { elevate } from 'wix-auth'; // define policy ID and policy object to update const id = '52f15c5c-ea06-44f4-866a-b1cfa6f4f790'; const policy = { 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.', revision: '2', eventId: '3d3d5c04-ece0-45a8-85f0-11a58edaa192' }; // update policy export const elevatedUpdatePolicyFunction = webMethod(Permissions.Anyone, async () => { const elevatedUpdatePolicy = elevate(policies.updatePolicy); try { const result = await elevatedUpdatePolicy(id, policy); return result; } catch (error) { console.error(error); // Handle the error } }); /* Promise resolves to: * { * "_id": "52f15c5c-ea06-44f4-866a-b1cfa6f4f790", * "revision": "3", * "_createdDate": "2023-03-07T14:15:44.312Z", * "_updatedDate": "2023-03-07T14:51:52.994Z", * "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" * } */ ``` ---