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.
Authorization
Request
This endpoint does not take any parameters
Response Object
Fulfilled - When the contact is updated. Rejected - Error message.
Returns an empty object.
Status/Error Codes
Was this helpful?
Update an existing contact
This example uses a deprecated function.
1import { Permissions, webMethod } from 'wix-web-module';2import wixCrmBackend from 'wix-crm-backend';34export const myBackendFunction = webMethod(Permissions.Anyone, (contactId, firstName, lastName, email, phone) => {5 wixCrmBackend.updateContact(contactId, {6 "firstName": firstName,7 "lastName": lastName,8 "emails": [email],9 "phones": [phone]10 } )11 .then( () => {12 // contact has been updated13 } )14 .catch( (err) => {15 // there was an error updating the contact16 } );17});