renameLabel( )
Description
The renameLabel()
function returns a Promise
that resolves when the specified label's display name is changed.
Note: Only visitors with Manage Contacts permissions can rename labels. You can override the permissions by setting the
suppressAuth
option totrue
.
Syntax
function renameLabel(key: string, displayName: string, [options: AuthOptions]): Promise<Label>
renameLabel Parameters
NAME
TYPE
DESCRIPTION
Label key.
key
is generated when the label is created
and cannot be modified, even if displayName
changes.
Label display name shown in the Dashboard.
Authorization options.
Returns
Fulfilled - Updated label.
Return Type:
NAME
TYPE
DESCRIPTION
Label key.
key
is generated when the label is created
and cannot be modified, even if displayName
changes.
Label display name shown in the Dashboard.
Label type.
One of:
"SYSTEM"
: The label is a predefined system label for the Contact List."USER_DEFINED"
: The label was created by a site contributor or app."WIX_APP_DEFINED"
: The label was created by a Wix app.
Date and time the label was created.
Date and time the label was last updated.
Label namespace.
Labels created by site contributors or 3rd-party apps
are automatically assigned to the custom
namespace.
Was this helpful?
Rename a label
1import { Permissions, webMethod } from 'wix-web-module';2import { contacts } from 'wix-crm-backend';34export const myRenameLabelFunction = webMethod(Permissions.Anyone, () => {5 const labelKey = "custom.incoming-leads";6 const displayName = "Incoming";7 const options = {8 suppressAuth: false9 };1011 return contacts.renameLabel(labelKey, displayName, options)12 .then((renamedLabel) => {13 return renamedLabel;14 })15 .catch((error) => {16 console.error(error);17 });18});1920/* Promise resolves to:21 *22 * {23 * "_createdDate": "2021-01-19T21:38:49Z",24 * "_updatedDate": "2021-01-20T19:07:54Z"25 * "namespace": "custom",26 * "key": "custom.incoming-leads",27 * "displayName": "Incoming",28 * "labelType": "USER_DEFINED"29 * }30 */