pass Boolean to CRM

Does anyone know if it is possible with Wix code to pass a boolean to the CRM.

When new members resister on a website they enter their details such as name, email, etc and these details are passed to the CRM where they can be viewed by the site owner. This part all works fine.

However when new members resister they also have to tick a Checkbox stating that they agree to the term & conditions of the website. I want to pass this Checkbox Boolean value to the CRM

Is this possible ?

Hi Mike:

There are a couple of ways you could do this.

  1. You could create a custom field in the CRM that captures say the date that T’s & C’s were accepted (basically the existence of a record of any type means they said yes! This can be added to the register or createContact function calls in the contactInfo object:
let contactInfo = {
  "firstName": firstName,
  "lastName": lastName,
  "emails": [email],
  "phones": [phone],
  "customField1": "customValue1",    <------ 
  "customField2": "customValue2"
};
  1. You could use the labels field in the CRM which again would only exist in the record if the user had clicked on the T’s and C’s checkbox. This would be added to the contactInfo object similar to the phone and email records like this:
let contactInfo = {
  "firstName": firstName,
  "lastName": lastName,
  "emails": [email],
  "phones": [phone],
  "labels": ['tsAndCs'],  <-------
  "customField1": "customValue1",
  "customField2": "customValue2"
};

Hope this helps

Steve

@Steve, yes I already have a number of text and date field values that I am passing to the CRM as part of the member registration form. However I am unable to pass the Boolean value for the checkbox to the CRM.

There can be optional checkboxes such as “allow marking emails” etc. In such a case I need to record the Boolean value for the checkbox so as I know the members chosen preference.

If i was passing a Boolean value to a database i would just use the code below but I can not find a way to do this for the Wix CRM.

$w(‘#dataset1’).setFieldValue(‘acceptTerms’, $w(‘#termsCheckbox’).valid);

@mikemoynihan99 Yes well for my suggestion you simply check to see if the check box is checked and set the CRM option you choose so

let contactInfo = {};
if ($w(‘#checkbox’).value === ‘checked’) {
contactInfo.labels = [‘tsAndCs’];
}

or

let contactInfo = {};
if ($w(‘#checkbox’).value === ‘checked’) {
contactInfo[‘Terms and Conditions’] = Date.now;
}

By the way checking valid only determines if the value is valid not what the value is :-).

Steve