Deprecated. This function will continue to work, but a newer version is available at wix-crm-backend.contacts.getContact().
Gets an existing contact by ID.
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.getContact()
.
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.getContactById()
,
and replace it with contacts.getContact()
.
Update your code to work with the new getContact()
call and response properties.
Test your changes to make sure your code behaves as expected.
The getContactById()
function returns a Promise that resolves to a contact
whose ID matches the given ID.
function getContactById(contactId: string): Promise<ContactInfo>;
The ID of the contact to get.
This example uses a deprecated function.
import { Permissions, webMethod } from "wix-web-module";
import wixCrmBackend from "wix-crm-backend";
export const myBackendFunction = webMethod(Permissions.Anyone, (contactId) => {
return wixCrmBackend.getContactById(contactId);
});
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.