Am using the contactInfo object to save data from a form to the Wix CRM contact list. It is also critically important to bring back the Zip code and persons title - i.e. Mr, Mrs to the CRM. See my code to scrape form the form.
const contactInfo = { // https://www.wix.com/code/reference/wix-crm.html#ContactInfo firstName: $w("#input1").value, lastName: $w("#input2").value, phones: [$w('#input15').value], emails: [$w("#input14").value], customField1: $w('#input11').value, customField2: $w('#dropdown2').value, customeField3: $w('#dropdown1').value }; const contactId = wixCRM.createContact(contactInfo).then( contactId => {
I see that the names used in the CRM contact section are different to the fields actually used in the contactInfo object i.e. the contact field in the display seems to annotate the name field as First Name and not the label firstName as provided in the properties list https://www.wix.com/code/reference/wix-crm.html#ContactInfo - it is what it is I suppose.
If I create a custom field in the contacts as per this article https://support.wix.com/en/article/adding-custom-fields-to-contacts - how on earth do I name it so that it is mapped to the customFieldx ? it seems easy enough to create custom fields but how to populate them via code ?
Hi ross
I'm fighting with similar problems as you at the moment. But I think I can answer your question: in your code you should use EXACTLY the same name you created manually in the contact list