Search.../

renameExtendedField( )

Renames an extended field.

Description

The renameExtendedField() function returns a Promise that resolves when the specified extended field's display name is changed.

Note: Only visitors with Manage Contacts permissions can rename extended fields. You can override the permissions by setting the suppressAuth option to true.

Syntax

function renameExtendedField(key: string, displayName: string, [options: AuthOptions]): Promise<ExtendedField>

renameExtendedField Parameters

NAME
TYPE
DESCRIPTION
key
string

Extended field ID.

When accessing contact data, extended field data is available at extendedFields[key]. For example, if the key is "custom.notes", the value can be accessed at extendedFields["custom.notes"].

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

displayName
string

Display name shown in the Contact List.

options
Optional
AuthOptions

Authorization options.

Returns

Fulfilled - Updated extended field.

Return Type:

Promise<ExtendedField>
NAME
TYPE
DESCRIPTION
key
string

Extended field ID.

When accessing contact data, extended field data is available at extendedFields[key]. For example, if the key is "custom.notes", the value can be accessed at extendedFields["custom.notes"].

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

displayName
string

Extended field display name shown in the Contact List.

dataType
string

Type of data the field holds.

One of:

  • "TEXT": Accepts strings.
  • "URL": Accepts web addresses. Prepends https:// if no protocol is included.
  • "DATE": Accepts dates formatted as "YYYY-MM-DD".
  • "NUMBER": Accepts floats.
fieldType
string

Indicates whether the extended field is a system field or custom field.

One of:

  • "SYSTEM": The field is a system field managed by Wix. System fields cannot be modified by 3rd-party apps or site contributors.
  • "USER_DEFINED": The field is a custom field and can be modified by 3rd-party apps or site contributors.
_createdDate
Date

Date and time the field was created.

_updatedDate
Date

Date and time the field was last updated.

namespace
string

Extended field namespace.

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

description
string

Field description, if the field is a system field.

Was this helpful?

Rename an extended field

Copy Code
1import { contacts } from 'wix-crm-backend';
2
3export function myRenameExtendedFieldFunction() {
4 const fieldKey = "custom.event-venue";
5 const displayName = "Event Location";
6 const options = {
7 suppressAuth: false
8 };
9
10 return contacts.renameExtendedField(fieldKey, displayName, options)
11 .then((renamedExtendedField) => {
12 return renamedExtendedField;
13 })
14 .catch((error) => {
15 console.error(error);
16 });
17}
18
19/* Promise resolves to:
20 *
21 * {
22 * "_createdDate": "2021-01-19T22:06:34Z",
23 * "_updatedDate": "2021-01-20T18:54:14Z"
24 * "namespace": "custom",
25 * "key": "custom.event-venue",
26 * "displayName": "Event Location",
27 * "dataType": "TEXT",
28 * "fieldType": "USER_DEFINED",
29 * }
30 */