Search...
deleteLabel( )
Developer Preview
Deletes a label from the site and removes it from contacts it applies to.
Description
The deleteLabel()
function returns a Promise that resolves when the specified label is deleted.
Admin Method
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function deleteLabel(key: string): Promise<void>
deleteLabel Parameters
NAME
TYPE
DESCRIPTION
key
string
Label key to delete.
Returns
Return Type:
Promise<
void
>Was this helpful?
Delete a label (dashboard page code)
Copy Code
1import { labels } from 'wix-crm.v2';23/* Sample key value: 'custom.at-risk' */45export async function myDeleteLabelFunction(key) {67 try {8 const deletedLabel = await labels.deleteLabel(key);9 console.log('Label deleted.');1011 } catch (error) {12 console.log(error);13 // Handle the error14 }15}1617/* Promise resolves to void */
Delete a label (export from backend code)
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { labels } from 'wix-crm.v2';3import { elevate } from 'wix-auth';45/* Sample key value: 'custom.at-risk' */67export const myDeleteLabelFunction = webMethod(Permissions.Anyone, async (key) => {8 try {9 const elevatedDeleteLabel = elevate(labels.deleteLabel);10 const deletedLabel = await elevatedDeleteLabel(key);11 console.log('Label deleted.');12 } catch (error) {13 console.log(error);14 // Handle the error15 }16});1718/* Promise resolves to void */