getContactById( )
Deprecated. This function will continue to work, but a newer version is available at wix-crm-backend.contacts.getContact().
Description
Gets an existing contact by ID.
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.getContact()
.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.getContactById()
, and replace it withcontacts.getContact()
. Update your code to work with the newgetContact()
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.
Syntax
function getContactById(contactId: string): Promise<ContactInfo>
getContactById Parameters
NAME
TYPE
DESCRIPTION
The ID of the contact to get.
Returns
Fulfilled - The given contact's information. Rejected - Error message.
Return Type:
NAME
TYPE
DESCRIPTION
Contact's first name.
Contact's last name.
Contact's image source.
List of contact's email addresses. When creating a contact, if no phone number is provided, at least one email address must be provided.
Email address the contact who is also a member uses to log into the system.
List of contact's phone numbers. When creating a contact, if no email is provided, at least one phone number must be provided.
List of contact's labels. Labels
are used to organize contacts. When setting the labels
property, you can
only list labels that already exist in your site's Contacts List.
Any number of custom fields. Custom fields are used to store additional information about your site's contacts. When setting a custom field, use key:value pairs, where the key matches the display names in your site's Contacts List. You can only set values for custom fields that already exist in the Contacts application.
Was this helpful?
Get a contact by ID
This example uses a deprecated function.
1import wixCrmBackend from 'wix-crm-backend';23export function myBackendFunction(contactId) {4 return wixCrmBackend.getContactById(contactId);5}6