wix-crm/wix-users | Update currentUser with form

Hello,

I want to create a form for the logged-in user to update information in the CRM.

The problem is that with “wixCRM.createContact”, if I put the email address to refresh the data in the CRM, there is an error because the address is already updated. How to change the user who is online going through a custom form?

Knowing that I want to integrate customFields at the time of the update.

Thanks in advance,

Hi,
If there is a matching existing contact, it is updated with the information specified using the contactInfo parameter.
For more information:

Roi.

Thank you.

But if i write :

let contactInfo = {
 "emails": [userEmail],
 "pseudos": "newPseudo"
};

  wixCRM.createContact(contactInfo)
  .then( (contactId) => {
    console.log(contactId);
  } );

i have this error in console :

Do you have a idea please ?
It’s not updated…

Yes i get the same exact error
I think it was because your updating contact using the code but without submitting the form

I was frustrated at start later on i found out we have to submit the form to create / update in the wix crm

If you using a custom form try to use wix CRM code when the submit button is clicked

Hope that make sense

Thank you for your reply Salman !

Do you have any code examples that work? I am looking for a solution for several days and my tests remain unfinished …

I put the function in an event “when we click on the button” but I do not see any event in the forms during the treatment … I am very interested if you can help me!

Thank you,
J.

Check this site
for code snippet and video

Credits : Nayeli (Code Queen)

Inclued code into onClick function but same error again…


No ideas ?
J.

Did you submit the form?

Yes… Button is fix on Submit


And the code is basic … :

And same error again and again…


I Despair… :frowning:

No ideas ? :disappointed_relieved:

Hi,
Currently, there is no way to update contact info for logged in members with wix code.
The way to update contact info is to install the login members app and get a member info page. Notice that there is no option for custom fields there yet.

We are planning to allow this via wix code, but we have security concerns to consider.

any idea of the ETA on the ability to display/update crm custom fields via wix code?

So, could you please explain when custom fields can be used and how to use them? I find this very confusing and the wix code manual is not really helping.

Say I just triggered users to register their e-mail and password and now - on a seperate page - I want their contact information to be added to the wix CRM, the following code does not seem to work:

import wixCRM from ‘wix-crm’;
import wixLocation from ‘wix-location’

$w.onReady( function () {
$w(“#register”).onClick( () => {
wixCRM.createContact( {
“firstName”: $w(“#firstName”).value,
“lastName”: $w(“#lastName”).value,
“PostalCode”: $w(‘#PostalCode’).value,
“Country” : $w(‘#Country’).value,
“HighestDegree”: $w(‘#HighestDegree’).value,
“ProfessionalSituation”: $w(‘#ProfessionalSituation’).value,
“Company” : $w(‘#Company’).value
.then(()=>{
wixLocation.to(‘/registratie-succesvol’);
})

    }) 

}) 

})

Help is much appreciated. Thanks in advance.

How is the sittuation going? is it possible now? Thank you Alon