deleteContact( )
Deprecated. This function will continue to work, but a newer version is available at wix-crm-backend.contacts.deleteContact().
Description
Deletes an existing contact.
Migration Instructions
If this function is already in your code, it will continue to work. To stay compatible with future changes, migrate to
wix-crm-backend.contacts.deleteContact()
.To migrate to the new function:
Add the new import statement:
javascript | Copy Codeimport { contacts } from 'wix-crm-backend'If you plan to migrate all contact functions that use
wixCrmBackend
, remove the originalimport wixCrmBackend
statement.Look for any code that uses
wixCrmBackend.deleteContact()
, and replace it withcontacts.deleteContact()
. Update your code to work with the newdeleteContact()
call and response properties.Test your changes to make sure your code behaves as expected.
The deleteContact()
function returns a Promise that resolves when the
contact with the given ID is deleted.
Syntax
function deleteContact(contactId: string, options: DeleteOptions): Promise<void>
deleteContact Parameters
NAME
TYPE
DESCRIPTION
The ID of the contact to delete.
Options to use when deleting the contact.
Returns
Fulfilled - When the contact is deleted. Rejected - Error message.
Return Type:
Was this helpful?
This example uses a deprecated function.
1import wixCrmBackend from 'wix-crm-backend';23export function deleteContact(contactId) {4 wixCrmBackend.deleteContact(contactId)5 .then( () => {6 // contact has been deleted7 })8 .catch( (err) => {9 // there was an error deleting the contact10 });11}12
This example uses a deprecated function.
1import wixCrmBackend from 'wix-crm-backend';23export function deleteContactForcefully(contactId) {4 const options = {5 "deleteMembers": true6 };78 wixCrmBackend.deleteContact(contactId, options)9 .then( () => {10 // contact has been deleted11 })12 .catch( (err) => {13 // there was an error deleting the contact14 });15}16