updateContact( )
Deprecated. This function will continue to work, but a newer version is available at wix-crm-backend.contacts.updateContact().
Description
Updates 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.updatecontact()
.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.updateContact()
, and replace it withcontacts.updateContact()
. Update your code to work with the newupdateContact()
call and response properties.Test your changes to make sure your code behaves as expected.
The updateContact()
function returns a Promise that resolves when the
contact with the specified ID has been updated.
Only the properties passed in the ContactInfo
object will
be updated. All other properties will remain the same.
Syntax
function updateContact(contactId: string, contactInfo: ContactInfo): Promise<void>
updateContact Parameters
NAME
TYPE
DESCRIPTION
The ID of the contact to update.
The information to update.
Returns
Fulfilled - When the contact is updated. Rejected - Error message.
Return Type:
Was this helpful?
Update an existing contact
This example uses a deprecated function.
1import wixCrmBackend from 'wix-crm-backend';23export function myBackendFunction(contactId, firstName, lastName, email, phone) {4 wixCrmBackend.updateContact(contactId, {5 "firstName": firstName,6 "lastName": lastName,7 "emails": [email],8 "phones": [phone]9 } )10 .then( () => {11 // contact has been updated12 } )13 .catch( (err) => {14 // there was an error updating the contact15 } );16}17