Search.../

renameLabel( )

Developer Preview

Updates a label's specified properties.

Description

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 renameLabel(key: string, label: RenameLabel, options: RenameLabelOptions): Promise<ContactLabel>

renameLabel Parameters

NAME
TYPE
DESCRIPTION
key
string

Label key.

key is generated when the label is created and cannot be modified, even if displayName changes.

label
RenameLabel

Label display name to rename.

options
Optional
RenameLabelOptions

Language options.

Returns

Renames a label.

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 a label.

Return Type:

Promise<
ContactLabel
>
NAME
TYPE
DESCRIPTION
_createdDate
Date

Date and time the label was created.

_updatedDate
Date

Date and time the label was last updated.

displayName
string

Label display name shown in the Dashboard.

key
string

Label key.

key is generated when the label is created and cannot be modified, even if displayName changes.

labelType
string

Label type.

  • "SYSTEM": The label is a default system label for the Contact List.
  • "USER_DEFINED": The label was created by a site contributor or 3rd-party app.
  • "WIX_APP_DEFINED": The label was created by a Wix app.
namespace
string

Label namespace.

Labels created by site contributors or 3rd-party apps are automatically assigned to the custom namespace.

namespaceDisplayName
string

Display name for the namespace, used to organize the list of labels in the site Dashboard.

Was this helpful?

Rename a label

Copy Code
1import { labels } from 'wix-crm.v2';
2
3export function myRenameLabelFunction() {
4 const key = 'custom.incoming-leads';
5 const label = {
6 displayName : 'Incoming'
7 };
8
9 return labels.renameLabel(key, label)
10 .then((renamedLabel) => {
11 return renamedLabel;
12 })
13 .catch((error) => {
14 console.error(error);
15 });
16}
17
18/* Promise resolves to:
19 *
20 * {
21 * "_createdDate": "2021-01-19T21:38:49Z",
22 * "_updatedDate": "2021-01-20T19:07:54Z"
23 * "namespace": "custom",
24 * "key": "custom.incoming-leads",
25 * "displayName": "Incoming",
26 * "labelType": "USER_DEFINED"
27 * }
28 */