When creating a workflow check condition in Microsoft Dynamics CRM 2013, you may have come across the need to list the values of a specific field that satisfy the check condition criteria. The most straightforward way to do this is to use the EQUALS operator and list each value that satisfies the check condition on its own line and then group them by OR.
However, this can become cumbersome to create if the list of values is particularly long. Fortunately, if the field in question is of either the Lookup or Option Set type, you can select all of the specific values that satisfy the check condition criteria on a single line, which is a much quicker process.
First, choose the EQUALS operator and select the search icon on the value entry field.
Next, select the records you would like to include in the check condition line item.
Lastly, click the Select button and then click OK to complete the process.
This will result in a list of values entered on one line.
The Option Set mechanism for accomplishing this same task functions slightly differently.
However, the outcome is identical.
Occasionally, the field in question will be a free form text field. In this case, the same options available for Lookup and Option Set field types do not present themselves. You could return to creating a line for each value you would like to include and use the CONTAINS or EQUALS operators in a similar fashion to method described in the beginning. Once again, this is cumbersome for a large list of values. In particular, while you may have the list of values neatly listed in a text file ready to be copied and pasted all at once, you nonetheless must manually configure each line in the check condition and enter a unique value per line.
This is where the IN operator comes to the rescue. For text fields, the IN operator allows you to compile your list of values to be used as check condition criteria in a semicolon delimited format (no spaces after the semicolons), which can be entered on one line of the check condition just as with Lookups and Option Sets.
Below, a text field is the check condition target. The operator selected is the IN operator. A semicolon delimited list with no spaces after the semicolons has been entered to complete the check condition line item.
While it is definitely best practice to structure the data entered in Microsoft Dynamics CRM 2013 via data types such as Option Sets and Booleans, you may still encounter the need to create workflows that have text fields in their check conditions. The IN operator allows you to bring the same design functionality to bear on text fields that is present with Option Sets and Lookups. If you enjoyed this blog, make sure to check out the rest of our Dynamics CRM blogs or sign up for one of our Dynamics CRM events or webinars!