renameLabel( )


Renames a label.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Members and Contacts - all permissions
Manage Contact Labels
Learn more about app permissions.
Method Declaration
Copy
function renameLabel(
  key: string,
  label: RenameLabel,
  options: RenameLabelOptions,
): Promise<ContactLabel>;
Method Parameters
keystringRequired

Label key.

key is generated when the label is created. It can't be modified, even if displayName is updated.


labelRenameLabelRequired

Label to rename.


optionsRenameLabelOptions

Language options.

Returns
Return Type:Promise<ContactLabel>
JavaScript
import { labels } from "wix-crm.v2"; /* Sample key value: * * 'custom.active-customer' * * Sample label object: * { * displayName: "Customer" * } */ export async function myRenameLabelFunction(key, label) { try { const renamedLabel = await labels.renameLabel(key, label); console.log("successfully renamed label:", renamedLabel); return renamedLabel; } catch (error) { console.log(error); // Handle the error } } /* Promise resolves to: * { * "namespace": "custom", * "namespaceDisplayName": "Labels", * "key": "custom.active-customer", * "displayName": "Customer", * "labelType": "USER_DEFINED", * "legacyId": "74f1e5c6-d9d5-4485-b272-13081ea35f38", * "_createdDate": "2023-12-25T06:13:21.000Z", * "_updatedDate": "2023-12-25T09:14:37.000Z" * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?