If you’ve worked with Dialogs in Dynamics CRM 2011, 2013 or 2015 you have probably seen the option to add a step called “Query CRM Data.” Odds are, you’ve ignored this because you haven’t understood what it is or how it could be used. It’s actually a useful tool for making cleaner, easier to use Dialogs in CRM. Here’s how it works, why and how you might use it.
The Query CRM Data step lets you specify a query to be run on an entity, then allows you to use the set of records returned as options in a dynamic option set in your Dialog. For example, say you create a dialog to quickly create a Phone Call record on an account. You could accomplish this by creating an Account Dialog and simply adding a Contact lookup to find let the user find the recipient. But, the problem is that the lookup is open to all Contacts, not just those associated with the Account. You can use Query CRM Data to narrow down that list into a convenience dropdown of Contacts for that particular Account only.
Here’s how to create a dialog for the example above:
- In CRM, navigate to Settings > Processes
- Create a new Dialog process for Account with the name “Log Quick Phone Call”
- Click Add Step > Query CRM Data and click Set Properties
- Look for Contacts, and add the criteria Company, Name Equals, and pick any account (it will be replaced in the next step)
- Click the Modify Query Variables tab
- Clear the value for Variable1, and insert the dynamic value Opportunity > Account
- Click Save and Close
- Click Add Step > Page, then Add Step Prompt and Response, then select Phone Call and click Set Properties
- Select a Response Type of Option Set and provide values from Query CRM Data
- Select the Last Name and First Name columns and enter a the separator as comma-space (, )
- Fill in the name and other required fields and click Save and Close
- Click Add Step > Create Record and click Set Properties
- Insert the dynamic data from the Prompt and Response question into the Recipient field
- Fill in other required and default values as desired and click Save and Close
- Click Activate, and try out your new Dialog on an Account!
You can even use a value from a previous prompt and response as a variable in a query to present very dynamic and directed responses in complex Dialogs. Can you think of any other good uses for the Query CRM Data step? Let me know your inventive uses in the comments below.