> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # UpdateExtendedField # Package: contacts # Namespace: ContactExtendedFieldsServiceV4 # Method link: https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/extended-fields/update-extended-field.md ## Permission Scopes: Manage Contact Extended Fields: SCOPE.DC-CONTACTS.MANAGE-EX-FIELDS ## Introduction Renames an extended field. --- ## REST API ### Schema ``` Method: updateExtendedField Description: Renames an extended field. URL: https://www.wixapis.com/contacts/v4/extended-fields/{field.key} Method: PATCH # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: field.key, field.displayName Method parameters: param name: field | type: ExtendedField | description: Extended field that was found or created. - name: key | type: string | description: Extended field key. 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 can't be modified, even if `displayName` changes. | required: true - name: displayName | type: string | description: Display name shown in the contact list. | required: true Return type: UpdateExtendedFieldResponse - name: field | type: ExtendedField | description: Renamed extended field. - name: namespace | type: string | description: Extended field namespace. Extended fields created through by calling the Find Or Create Extended Field method are automatically assigned to the `custom` namespace. - name: key | type: string | description: Extended field key. 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 can't be modified, even if `displayName` changes. - name: displayName | type: string | description: Display name shown in the contact list. - name: dataType | type: FieldDataType | description: Type of data the field holds. - enum: - TEXT: Accepts strings. - NUMBER: Accepts floats. - DATE: Accepts dates formatted as `YYYY-MM-DD`. - URL: Accepts strings. Prepends `https://` if no protocol is included. - name: fieldType | type: FieldType | description: Indicates whether the extended field is a system field or custom field. - enum: - SYSTEM: Field is a system field managed by Wix. System fields can't be modified by calling the Update Extended Field method. - USER_DEFINED: Field is a custom field and can be modified by calling the Update Extended Field method. - name: createdDate | type: string | description: Date and time the field was created. - name: updatedDate | type: string | description: Date and time the field was last updated. - name: description | type: string | description: Field description, if the field is a system field. ``` ### Examples ### Update Extended Field ```curl curl -X PATCH 'https://www.wixapis.com/contacts/v4/extended-fields/custom.my-field' -H 'Content-Type: application/json' \ -H 'Authorization: ' \ --data-binary '{ "name": "My New Field Name" }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.contacts.ContactExtendedFieldsServiceV4.updateExtendedField(key, field) Description: Renames an extended field. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: key, field.displayName, field Method parameters: param name: field | type: ExtendedField | description: Extended field that was found or created. | required: true - name: displayName | type: string | description: Display name shown in the contact list. | required: true param name: key | type: string | description: null | required: true Return type: PROMISE - name: namespace | type: string | description: Extended field namespace. Extended fields created through by calling the Find Or Create Extended Field method are automatically assigned to the `custom` namespace. - name: key | type: string | description: Extended field key. 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 can't be modified, even if `displayName` changes. - name: displayName | type: string | description: Display name shown in the contact list. - name: dataType | type: FieldDataType | description: Type of data the field holds. - enum: - TEXT: Accepts strings. - NUMBER: Accepts floats. - DATE: Accepts dates formatted as `YYYY-MM-DD`. - URL: Accepts strings. Prepends `https://` if no protocol is included. - name: fieldType | type: FieldType | description: Indicates whether the extended field is a system field or custom field. - enum: - SYSTEM: Field is a system field managed by Wix. System fields can't be modified by calling the Update Extended Field method. - USER_DEFINED: Field is a custom field and can be modified by calling the Update Extended Field method. - name: _createdDate | type: Date | description: Date and time the field was created. - name: _updatedDate | type: Date | description: Date and time the field was last updated. - name: description | type: string | description: Field description, if the field is a system field. ``` ### Examples ### Rename an extended field (with elevated permissions) ```javascript import { extendedFields } from '@wix/crm'; import { auth } from '@wix/essentials'; /* Sample key value: * * 'custom.nickname' * * Sample field value: * { * 'Contact Nickname' * } */ const elevatedRenameExtendedField = auth.elevate(extendedFields.renameExtendedField); export async function myRenameExtendedFieldFunction(key, field) { try { const renamedExtendedField = await elevatedRenameExtendedField(key, field); console.log('Successfulyl renamed extendedField:', renamedExtendedField); return renamedExtendedField; } catch (error) { console.log(error); // Handle the error } } /* Promise resolves to: * { * "namespace": "custom", * "key": "custom.nickname", * "displayName": "Contact Nickname", * "dataType": "TEXT", * "fieldType": "USER_DEFINED", * "legacyId": "63408eaf-e3d0-43f3-afa5-942847d272a1", * "wixSearchColumn": "info_extendedFields_custom_string_18", * "_createdDate": "2023-12-25T12:21:42.000Z", * "_updatedDate": "2023-12-25T13:25:35.000Z" * } */ ``` ### Rename an extended field ```javascript import { extendedFields } from '@wix/crm'; /* Sample key value: * * 'custom.nickname' * * Sample field value: * { * 'Contact Nickname' * } */ export async function myRenameExtendedFieldFunction(key, field) { try { const renamedExtendedField = await extendedFields.renameExtendedField(key, field); console.log('Successfulyl renamed extendedField:', renamedExtendedField); return renamedExtendedField; } catch (error) { console.log(error); // Handle the error } } /* Promise resolves to: * { * "namespace": "custom", * "key": "custom.nickname", * "displayName": "Contact Nickname", * "dataType": "TEXT", * "fieldType": "USER_DEFINED", * "legacyId": "63408eaf-e3d0-43f3-afa5-942847d272a1", * "wixSearchColumn": "info_extendedFields_custom_string_18", * "_createdDate": "2023-12-25T12:21:42.000Z", * "_updatedDate": "2023-12-25T13:25:35.000Z" * } */ ``` ### renameExtendedField (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { extendedFields } from '@wix/crm'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { extendedFields }, // Include the auth strategy and host as relevant }); async function renameExtendedField(key,field) { const response = await myWixClient.extendedFields.renameExtendedField(key,field); }; ``` ---