Search.../

deleteExtendedField( )

Developer Preview

Deletes an extended field.

Description

The deleteExtendedField() function returns a Promise that resolves when the specified extended field is deleted.

When an extended field is deleted, any contact data stored in the field is permanently deleted as well.

Note: Only visitors with Manage Contacts permissions can delete extended fields.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function deleteExtendedField(key: string): Promise<void>

deleteExtendedField Parameters

NAME
TYPE
DESCRIPTION
key
string

Extended field key.

Returns

Return Type:

Promise<
void
>

Was this helpful?

Delete an extended field (dashboard page code)

Copy Code
1import { extendedFields } from 'wix-crm.v2';
2
3/* Sample key value: 'custom.nickname' */
4
5export async function myDeleteExtendedFieldFunction(key) {
6
7 try {
8 const extendedField = await extendedFields.deleteExtendedField(key);
9 console.log('Extended field deleted.')
10
11 return extendedField;
12 } catch (error) {
13 console.log(error);
14 // Handle the error
15 }
16}
17
18/* Promise resolves to void */
Delete an extended field (export from backend code)

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { extendedFields } from 'wix-crm.v2';
3import { elevate } from 'wix-auth';
4
5/* Sample key value: 'custom.nickname' */
6
7export const myDeleteExtendedFieldFunction = webMethod(Permissions.Anyone, async (key) => {
8
9 try {
10 const elevatedDeleteExtendedField = elevate(extendedFields.deleteExtendedField);
11 const extendedField = await elevatedDeleteExtendedField(key);
12 console.log('Extended field deleted.')
13
14 return extendedField;
15 } catch (error) {
16 console.log(error);
17 // Handle the error
18 }
19});
20
21/* Promise resolves to void */