Search.../

renameExtendedField( )

Developer Preview

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.

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 renameExtendedField(key: string, field: RenameExtendedField): Promise<ExtendedField>

renameExtendedField Parameters

NAME
TYPE
DESCRIPTION
key
string

Extended field key.

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

Once set, key cannot be modified, even if displayName changes.

field
RenameExtendedField

Extended field display name to rename.

Returns

Updated extended field.

Return Type:

Promise<
ExtendedField
>
NAME
TYPE
DESCRIPTION
_createdDate
Date

Date and time the field was created.

_updatedDate
Date

Date and time the field was last updated.

dataType
string

Type of data the field holds.

One of:

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

Field description, if the field is a system field.

displayName
string

Display name shown in the Contact List.

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.
key
string

Extended field key.

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

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

namespace
string

Extended field namespace.

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

Was this helpful?

Rename an extended field

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