Hi there! Want
to see some
related articles?

Working with Lookup and OptionSet Fields

Lookup/OptionSet fields in Dynamics CRM are drop-down fields in Dynamics such as Lead SourcePreferred 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 Lookup/OptionSet field to a form so that it can be mapped in a feed and flow through to Dynamics CRM.

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 Lookup/OptionSet field you wish to map.

  1. If you have not already done so, log into your Dynamics CRM instance.
  2. Once logged in, navigate to the entity (lead/contact) that contains the lookup field you would like to map. For example Sales > Leads.
  3. Next, click on an existing lead record.
  4. On the lead detail screen, click the "..." button and then Form Editor.
  5. In the Form Editor, locate the Lookup/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.
  6. In the Field Properties dialog, click the Details tab.
  7. On the Details tab, click the Edit button to open the Field definition window.
  8. In the Field definition window, scroll down to the Options box that displays the different field values.
  9. 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."
  10. 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.

  11. 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.
  12. 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 Lookup/OptionSet field, the steps are very similar to above. The difference is that instead of only selecting the value of one option from a Lookup/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 Lookup/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 Gravity Forms Dynamics CRM and Lookup/OptionSet fields you can achieve fine-grained control over how form submissions and various field types flow into Dynamics CRM.