Deprecated. This function will continue to work, but a newer version is available at wix-crm-backend.contacts.deleteContact().
Deletes an existing contact.
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:
import { contacts } from "wix-crm-backend";
If you plan to migrate all contact functions that use wixCrmBackend
,
remove the original import wixCrmBackend
statement.
Look for any code that uses wixCrmBackend.deleteContact()
,
and replace it with contacts.deleteContact()
.
Update your code to work with the new deleteContact()
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.
function deleteContact(
contactId: string,
options: DeleteOptions,
): Promise<void>;
The ID of the contact to delete.
Options to use when deleting the contact.
This example uses a deprecated function.
import { Permissions, webMethod } from "wix-web-module";
import wixCrmBackend from "wix-crm-backend";
export const deleteContact = webMethod(Permissions.Anyone, (contactId) => {
wixCrmBackend
.deleteContact(contactId)
.then(() => {
// contact has been deleted
})
.catch((err) => {
// there was an error deleting the contact
});
});
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.