getExtendedField( )


Retrieves an extended field.

The getExtendedField() function returns a Promise that resolves when the extended field is retrieved.

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

Method Declaration
Copy
function getExtendedField(
  key: string,
  options: AuthOptions,
): Promise<ExtendedField>;
Method Parameters
keystringRequired

Extended field ID .

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

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


optionsAuthOptions

Authorization options.

Returns
Return Type:Promise<ExtendedField>
Get an extended field
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myGetExtendedFieldFunction = webMethod(Permissions.Anyone, () => { const fieldKey = "custom.event-name"; const options = { suppressAuth: false, }; return contacts .getExtendedField(fieldKey, options) .then((extendedField) => { return extendedField; }) .catch((error) => { console.error(error); }); }); /* * Promise resolves to: * * { * "_createdDate": "2021-01-19T21:41:39Z", * "_updatedDate": "2021-01-19T21:41:39Z" * "namespace": "custom", * "key": "custom.event-name", * "displayName": "Event Name", * "dataType": "TEXT", * "fieldType": "USER_DEFINED", * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?