Search...
deleteLabel( )
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.
Note: Only visitors with Manage Contacts permissions can delete labels. You can override the permissions by setting the
suppressAuth
option totrue
.
Syntax
function deleteLabel(key: string, [options: AuthOptions]): Promise<void>
deleteLabel Parameters
NAME
TYPE
DESCRIPTION
key
string
Label key to delete.
options
Optional
AuthOptions
Authorization options.
Returns
Return Type:
Promise<void>
Was this helpful?
Delete a label
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { contacts } from 'wix-crm-backend';34export const myDeleteLabelFunction = webMethod(Permissions.Anyone, () => {5 const labelKey = "custom.new-lead";6 const options = {7 suppressAuth: false8 };910 return contacts.deleteLabel(labelKey, options)11 .then(() => {12 console.log("Label deleted");13 })14 .catch((error) => {15 console.error(error);16 });17});