findOrCreateExtendedField( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a custom field with a given name, or creates one if it doesn't exist.

The findOrCreateExtendedField() function returns a Promise that resolves when the specified custom field is found or created.

Successful calls to findOrCreateExtendedField() always return an extended field, which can be passed to subsequent function calls.

To find an existing extended field without potentially creating a new one, use getExtendedField() or queryExtendedFields().

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Contact Extended Fields
Manage Members and Contacts - all permissions
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
displayNamestringRequired

Display name to find or create.

If an existing custom field is an exact match for the specified displayName, the existing field is returned. If not, a new field is created and returned.


dataTypeFieldDataTypeRequired

Type of data the field holds. Ignored if an existing field is an exact match for the specified display name. 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.
Returns
Return Type:Promise<FindOrCreateExtendedFieldResponse>
Did this help?