Renames an extended field.
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
.
function renameExtendedField(
key: string,
displayName: string,
options: AuthOptions,
): Promise<ExtendedField>;
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.
import { Permissions, webMethod } from "wix-web-module";
import { contacts } from "wix-crm-backend";
export const myRenameExtendedFieldFunction = webMethod(
Permissions.Anyone,
() => {
const fieldKey = "custom.event-venue";
const displayName = "Event Location";
const options = {
suppressAuth: false,
};
return contacts
.renameExtendedField(fieldKey, displayName, options)
.then((renamedExtendedField) => {
return renamedExtendedField;
})
.catch((error) => {
console.error(error);
});
},
);
/* Promise resolves to:
*
* {
* "_createdDate": "2021-01-19T22:06:34Z",
* "_updatedDate": "2021-01-20T18:54:14Z"
* "namespace": "custom",
* "key": "custom.event-venue",
* "displayName": "Event Location",
* "dataType": "TEXT",
* "fieldType": "USER_DEFINED",
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.