Working with Picklist and OptionSet Fields
The Gravity Forms Dynamics CRM Add-On for WordPress includes great support for not only simple text and numeric fields but also Picklist/OptionSet fields in Dynamics CRM and Dynamics 365.
Picklist/OptionSet fields in Dynamics are drop-down fields such as Lead Source, Preferred Contact Method, etc.
Each option in the drop-down consists of a text label and a numeric value. These fields cannot simply be mapped like standard text fields on a form such as name, email or address fields. They require a little more setup, but are fully supported by the plugin.
This article will walk you through the process of how to add a Picklist/OptionSet field to a form so that it can be mapped in a feed and flow through to from WordPress to Dynamics CRM or Dynamics 365.
For the purpose of this article, we are going to walk through mapping the Lead Source field from the lead entity in Dynamics CRM. The process is the same regardless of the Picklist/OptionSet field you wish to map.
- If you have not already done so, login to your Dynamics CRM instance.
- Once logged-in, navigate to the entity (lead/contact) that contains the lookup field you would like to map. For example Sales > Leads.
- Next, click on an existing lead record.
- On the lead detail screen, click the "..." button and then Form Editor.
- In the Form Editor, locate the Picklist/OptionSet field you would like to map and double-click on it to open the Field Properties dialog. In our example, we double-click on Lead Source.
- In the Field Properties dialog, click the Details tab.
- On the Details tab, click the Edit button to open the Field definition window.
- In the Field definition window, scroll down to the Options box that displays the different field values.
- In the Options box, select the option you would like to map. In our example, we want our form entries to come in with a value of Lead Source = Web, so we click "Web."
- In the Value text box to the right, copy the numeric value as you'll need that value back on your Gravity Form.
IMPORTANT: Some instances of Dynamics CRM show commas in numeric values such as (1,000 or 100,000). If your Dynamics instance's numeric values contain commas, you'll need to remove the commas when setting up the value(s) in Gravity Forms. This is because the Dynamics CRM API that our plugin communicates with does not accept commas for these fields. It only accepts numeric digits. - Go back into your Gravity Form form editor and place a new hidden field on your form (in our example, we would name it Lead Source). We then paste the value (8) into the default value for this field.
- We can now map this field in the Dynamics CRM Feed and new form entries will create a lead with a Lead Source of "Web."
Here's a quick video of the steps above:
If you would like the user to be able to select the value for your Picklist/OptionSet field, the steps are very similar to above. The difference is that instead of only selecting the value of one option from a Picklist/OptionSet field in Dynamics CRM, you'll need to make a note of each text label and numeric value and replicate those in your form's dropdown or checkbox field.
Below is an example of using a drop-down for Lead Source and the Labels and Values for each option.
The process above is the same regardless of the Picklist/OptionSet field you would like to map or the entity type (lead/contact).
Two Option/Boolean Fields
Fields with a Data Type of "Two Options" such as Marketing Materials, Email, Bulk Email and Mail work slightly differently than other OptionSet fields. These fields are actually true/false (boolean) fields with a label corresponding to true and a label corresponding to false.
Below is a screenshot of what the Marketing Materials field looks like in the Dynamics CRM form editor:
And here is the dialog box showing the value:
Despite the "0" and "1" values displayed in the Dynamics CRM form editor, the Dynamics CRM API requires that these values be sent as true/false. Therefore, when mapping these types of fields in Gravity Forms, make sure your field values are set to true/false not 1/0.
Below is an example of how we would map the Marketing Materials field in Gravity Forms:
Using the power of the Gravity Forms Dynamics CRM Add-On and Picklist/OptionSet fields you can achieve fine-grained control over how form submissions and various field types flow from WordPress to Dynamics CRM or Dynamics 365.