Search.../

deletePolicy( )

Developer Preview

Permanently deletes a policy.

Description

The deletePolicy() function returns a Promise that resolves when the specified policy is deleted.

Deleted policies are not returned by the getPolicy() or queryPolicies() functions.

This function is not a universal function and runs only on the backend.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function deletePolicy(policyId: string): Promise<void>

deletePolicy Parameters

NAME
TYPE
DESCRIPTION
policyId
string

ID of the policy to delete.

Returns

Return Type:

Promise<
void
>

Was this helpful?

Delete Policy

Copy Code
1import { policies } from 'wix-events.v2';
2import * as wixAuth from 'wix-auth';
3
4//define policy ID
5const policyId = '0907cf78-5177-4482-a627-b17ef06badec';
6
7//delete policy
8function elevatedDeletePolicyFunction(){
9 const elevatedDeletePolicy = wixAuth.elevate(policies.deletePolicy);
10 try {
11 return elevatedDeletePolicy(policyId);
12 }
13 catch (error) {
14 console.error(error);
15 // Handle the error
16 }
17 };
18
19// Returns void