We have had
In a recent example, I wanted to create a dialog for quick case entry. The case form in Microsoft Dynamics CRM contains many fields, and it can sometimes be overwhelming for creation of simple cases. In this scenario, we want a quick entry form. Dialogs are perfect for this—we can create a dialog with just the questions that need to be answered to create a case, and then use the responses to create the case.
In this post I’m going to assume that you have a basic understanding of how dialogs work. If you don’t, I recommend the series of introductory posts on the
In my case dialog, I want the user to select an account, then have a picklist of contacts related to the selected account. When you look at the dialog wizard, it is not immediately obvious how to filter a picklist based on a value selected in an earlier picklist. Here are the things that you need to keep in mind:
1. Timing is important—you can’t call a value before it is defined
When I started defining the dialog, I first created the step to query the crm database for accounts, and then I tried to add the step to query the crm database for contacts, but it would not let me filter the contacts to the account query step.
I realized after pulling my hair out for a while, that the query step does not select a specific record, but rather provides the logic to populate the picklist of values, and the prompt-response step selects the value.
2. You have to first add the prompt response step, then add the query step filtered by the value selected.
I realized that I needed to insert a prompt response step first, asking the user to select an account, and then I could enter a query step and filter it by the value selected in the first prompt response. It looked like this:
Step 1: Query step
Step 2: Insert page with Prompt Response asking to select account based on the query defined in step 1
Step 3: Query step for contacts. In the advanced find query select Parent customer equals xyz. Go to the Modify Query Variables tab and select the variable1 field. Using the form assistant on the right, select the name of the second step in the "look for" menu and select the account field—this will dynamically filter this query to records related to the account selected
Step 4: Add prompt response to select contact based on the query created in step 3.
Once my steps were in the correct order, my picklist for contacts was filtered correctly. This is very powerful—using this approach, you could have a picklist filtered by multiple criteria. You can call the results of a prompt-response step multiple times, so that one picklist could also be used to filter additional picklists.
4. Dependent picklists cannot be located on the same wizard page
This may go without saying; but in the above example, since you can’t insert a query step while inside of a page in the dialog wizard, you will need to place dependent questions on a page of the dialog other than the page where the primary question is located. I can’t build my filtered query of contacts until the account has been selected in the prompt-response step, so I need to insert the first page, then insert my second query, then insert another page, where I can prompt for the contact.
As a best practice, I would recommend structuring your dialogs so that other questions are included on the first page, such as the subject or description, otherwise the dialog pages may look uneven with one question on the first page and multiple questions on the second.
Post by: Joel Lindstrom,