renameExtendedField( )
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 totrue
.
Syntax
function renameExtendedField(key: string, displayName: string, [options: AuthOptions]): Promise<ExtendedField>
renameExtendedField Parameters
NAME
TYPE
DESCRIPTION
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.
Display name shown in the Contact List.
Authorization options.
Returns
Fulfilled - Updated extended field.
Return Type:
NAME
TYPE
DESCRIPTION
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.
Extended field display name shown in the Contact List.
Type of data the field holds.
One of:
"TEXT"
: Accepts strings."URL"
: Accepts web addresses. Prependshttps://
if no protocol is included."DATE"
: Accepts dates formatted as"YYYY-MM-DD"
."NUMBER"
: Accepts floats.
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.
Date and time the field was created.
Date and time the field was last updated.
Extended field namespace.
Extended fields created by site contributors or 3rd-party apps
are automatically assigned to the custom
namespace.
Field description, if the field is a system field.
Was this helpful?
Rename an extended field
1import { Permissions, webMethod } from 'wix-web-module';2import { contacts } from 'wix-crm-backend';34export const myRenameExtendedFieldFunction = webMethod(Permissions.Anyone, () => {5 const fieldKey = "custom.event-venue";6 const displayName = "Event Location";7 const options = {8 suppressAuth: false9 };1011 return contacts.renameExtendedField(fieldKey, displayName, options)12 .then((renamedExtendedField) => {13 return renamedExtendedField;14 })15 .catch((error) => {16 console.error(error);17 });18});1920/* Promise resolves to:21 *22 * {23 * "_createdDate": "2021-01-19T22:06:34Z",24 * "_updatedDate": "2021-01-20T18:54:14Z"25 * "namespace": "custom",26 * "key": "custom.event-venue",27 * "displayName": "Event Location",28 * "dataType": "TEXT",29 * "fieldType": "USER_DEFINED",30 * }31 */