Building Business Processes in Dynamics CRM 2011: Installment 2
| June 21, 2011 – Here’s the second installment of the serialized version of my upcoming book, Building Business Processes in Dynamics CRM 2011. In Installment 1, I compared dialogs and workflows, discussed dialog properties, and introduced the most fundamental components of dialogs: Pages, and Prompt and Response pairs. In today’s excerpt I drill down and provide some more detail on how to construct Prompts and Responses. | This article is an excerpt from my upcoming book, Building Business Processes in Dynamics CRM 2011. Other articles in the series: |
Some of the highlights of today’s content:
- The importance of the response data type.
- A handy reference for commonly used option set fields on the case, account, contact, lead and opportunity entities.
- Tips on how to add value to your dialogs by using hyperlinks in Tip Text
Enjoy, and if you’ve got any killer examples or puzzling head-scratchers, please share them and help to improve the finished product!
Drilling Down on Prompts and Responses
Pages are really just containers for the Prompt/Response pairs of a dialog process; these are where the real work takes place, so in this section we will review them more thoroughly. When you are designing a dialog process and click Set Properties for a Prompt and Response action, you see the Define Prompt and Response dialog. Here is the first of the two Prompt/Response pairs from the previous example:

Statement Label is a required field, and as you saw previously, the value you enter in the Define Prompt and Response dialog is what appears in the Step Editor on the Description line for the Prompt and Response.
Prompt Text is also required. This is the text that instructs the user what to do. Depending on the business functionality, you may want to structure this as a question to be posed to a customer, or it may simply provide instructions for the user.
Tip Text is optional. Use it to provide additional instructions for your users. For example, in a “guided conversation” dialog, the prompt text might present the question a sales representative is instructed to ask the customer. The tip text in this case could provide internal guidance to the sales representative, such as what the goal of the question is, or some of your products/services that might be relevant to the question, or tips on how to engage the customer in conversation on the topic. Tip Text, as well as Prompt Text, can contain hyperlinks. You can really jazz up your dialogs with some creative linking, and we will cover that in more detail below.
Response Details are important, and although they are not required, it’s hard to imagine a scenario that would not require them! These are what allow the dialog process to do something with the information gathered from the user. The following table includes the possible response types:
| Response Type | Data Type(s) | Provide Values | Description |
| None | NA | NA | |
| Single Line |
|
NA | Allows user to enter information in a single line text field. Data Types described in detail below. |
| Option Set (radio buttons) |
|
|
Allows user to select one of two options. Can define available values within dialog, or can query from CRM data. Described in detail below. |
| Option Set (picklist) |
|
|
Allows user to select one value from a multi-valued picklist (option set) Can define available values within dialog, or can query from CRM data. |
| Multiple Lines (Text Only) | Text only | NA | Allows user to enter information in a multi-line text field. |
The Data Type and Provide Values settings are important enough to warrant special treatment in the following two sections.
Response Details: Data Type
As indicated in the table, there are three possible values for Data Type property, which is available only for Response Type values of Single Line, Option Set (radio buttons), and Option Set (picklist).
This is important aspect of dialog design and can be confusing at first, so let’s drill down on it.
Let’s extend the Create Case for Account dialog to understand the importance of the Data Type property. Suppose in addition to filling in the Title and Customer fields on the new case, you also wanted to fill in the Case Origin field. This is a system-defined option set field available for the case entity, and by default has values of Phone, E-Mail and Web.
Suppose you add a new prompt/response pair to the dialog, click Set Properties, and configure them as shown in the next figure:

The selected Data Type here is Text, which is the default value. (This is one of those places in Dynamics CRM where once you save a value, it cannot be changed.) After saving and closing the Define Prompt and Response dialog, the Step Editor will look like this:

You might then click Set Properties, thinking you can use Dynamic Values to update the Case Origin field with the value selected by the user in the process. The problem is that the Case Origin field on the case entity is an option set field, which although it has a label (Phone, E-mail, Web), is actually defined as an integer field. In the dialog, this means that you cannot update the field value with the process value, since it’s the wrong data type. You can see this in the following figure, where the selected field is Case Origin, and in the Dynamic Values section, the Case Origin variable has been selected in the Local Values section of the Look for drop-down:

If you try this, you will notice that you cannot select anything to populate to the Case Origin field on the case form. This is the standard behavior for when data types don’t match.
Now what you might try at this point is to build conditional logic into your dialog to work around this, testing for the value the user selected for the Case Origin in the dialog, and hard-wiring the entry of the corresponding option set value for Case Origin on the form. Yuck.
We will cover this in more detail below, but for now, let’s look at the right way to get this done!
The key is the Response Data Type, which in this example needs to be an Integer in order to directly update the Case Origin field. You will need to delete the Prompt and Response line (since you cannot change the Data Type once it’s saved), and re-do it like this:

The two most important things to notice are:
- The selected Data Type is Integer. This will allow you to update the Case Origin field on the case form with the value selected by the user as the dialog runs.
- Notice the Value of the Phone Response Value is 1. This must match up to the value stored by Dynamics CRM for that option set on the form.
Finally, after doing this, you can click Set Properties on the Create Case step of the dialog. The following figure illustrates that – once the correct data type is defined for the Case Origin dialog field – you can in fact directly update the Case Origin field on the case form. That’s what the “Response Option Set Value” field is for:

Tip: Commonly Used Option Set Values
The Dynamics CRM 2011 SDK contains a complete list of option set values for all system option set fields in the product…but that’s about as helpful as saying the dictionary contains a complete list of all the words in the English language! Like so many things, this issue – matching prompt/response values in a dialog to option set values for a Dynamics CRM field – has an 80/20 rule: most of your needs will be satisfied by a small number of the available options. In that spirit, this section includes the most frequently encountered option set fields from what we might refer to as the big five customizable entities in Dynamics CRM 2011. Since we’ve been discussing the Case entity, we start with that one, and then proceed alphabetically with Account, Contact, Lead and Opportunity.
-
Commonly Used Option Set Fields for the Case Entity
Option Set Field
Label (Schema Name)Default Label Corresponding Value Case Origin (caseorigincode) Phone 1 E-mail 2 Web 3 Case Type (casetypecode) Question 1 Problem 2 Request 3 Satisfaction (customersatisfactioncode) Very Satisfied 5 Satisfied 4 Neutral 3 Dissatisfied 2 Very Dissatisfied 1 Priority (prioritycode) High 1 Medium 2 Low 3 Service Level (contractservicelevelcode) Gold 1 Silver 2 Bronze 3 -
Commonly Used Option Set Fields for Account
Option Set Field
Label (Schema Name)Default Label Corresponding Value Address Type (address1_addresstypecode) Bill To 1 Ship To 2 Primary 3 Other 4 Shipping Method (address1_shippingmethodcode) Airborne 1 DHL 2 FedEx 3 UPS 4 Postal Mail 5 Full Load 6 Will Call 7 Freight Terms (address1_freighttermscode)
FOB 1 No Charge 2 Industry
(industrycode)Accounting 1 … … Wholesale 33 Ownership
(ownershipcode)Public 1 Private 2 Subsidiary 3 Other 4 Relationship Type (customertypecode) Competitor 1 Consultant 2 Customer 3 Investor 4 Partner 5 Influencer 6 Press 7 Prospect 8 Reseller 9 Supplier 10 Vendor 11 Other 12 Category
(accountcategorycode)Preferred Customer 1 Standard 2 -
Commonly Used Option Set Fields for Contact
Option Set Field
Label (Schema Name)Default Label Corresponding Value Address Type Same as Account Shipping Method Same as Account Freight Terms Same as Account Role
(accountrolecode)Decision Maker 1 Employee 2 Influencer 3 Gender
(gendercode)Male 1 Female 2 Marital Status (familystatuscode) Single 1 Married 2 Divorced 3 Widowed 4 Category
(accountcategorycode)Preferred Customer 1 Standard 2 Contact Method
(preferredcontactmethodcode)Same as Account -
Commonly Used Option Set Fields for Lead
Option Set Field
Label (Schema Name)Default Label Corresponding Value Lead Source
(leadsourcecode)Advertisement 1 Employee Referral 2 External Referral 3 Partner 4 Public Relations 5 Seminar 6 Trade Show 7 Web 8 Word of Mouth 9 Other 10 Rating
(leadratingcode)Hot 1 Warm 2 Cold 3 Industry
(industryscode)Same as Account Contact Method
(preferredcontactmethodcode)Same as Account -
Commonly Used Option Set Fields for Opportunity
Option Set Field
Label (Schema Name)Default Label Corresponding Value Revenue
(isrevenuesystemcalculated)System Calculated 1 User Provided 0 Rating
(opportunityratingcode)Hot 1 Warm 2 Cold 3 Response Details: Provide Values
The other important option to understand when collecting response from users is whether to enter values manually as you design the process, or to get them from a CRM query. This is an important and potentially complex topic, and we will cover it in detail later in the book. For now, consider the following figure:

In the previous examples, the Define Values option was selected, which means you simply enter the values yourself. Here, the Query CRM data option is selected. This is a super-important capability of dialog processes in Dynamics CRM 2011, as it lets you build prompts based on CRM data…so as the underlying data change, your dialog processes dynamically reflect the changing information.
In the previous figure, the Query Variable “Practices Query” has already been defined. Query variables must always be defined before they can be used (makes sense when you think about it, right?), and in the Step Editor it might look like this:

In this example, “Practices” is a custom entity my organization uses to track our different professional practice areas (e.g., CRM, Messaging…). If we want to associate a case record with a specific practice, the ability to build a query and populate a Prompt option set with all of our practices provides that ability.
Again, more details on this later, but it’s important to know at this point that you won’t always have to enter all of the possible option set values manually as you design the dialog process!
Tip: Use of Hyperlinks in Prompt Text and Tip Text.
Notice that both of these have a button you can use to enter a hyperlink. This gives you a way to use external web content to support your dialog processes, and the general rule is: as long as a user can get to the content, you can use it. For example, suppose you enter the following text to the Tip Text in the Create Case for Account dialog:

You can then position the cursor just after the “cases:” text, and click the

Insert Hyperlink button to get the Insert Hyperlink dialog:
The Text to display field is the link text the user will be able to click, and the URL is where they will navigate to. For example, you might enter the following values:

After clicking OK and returning to the Define Prompt and Response dialog, you will see the following in the Tip Text:

And after saving and activating the dialog, the user experience would appear like the following figure:

When a user clicks the link, the referenced URL will open in a new window. This gives you the ability to extend dialog processes in lots of interesting ways, including:
- Linking to special offer pages on a web site for a campaign follow-up dialog.
- Linking to Dynamics CRM forms using the “URL-addressable” forms technique that allows any record for any entity to be navigated to with its unique URL. For example, if you use the product catalog, a specific product form could be opened with a URL like this one:
https://<yourorganizationhere>/main.aspx?etc=1024&extraqs=%3f_gridType%3d1024%26etc%3d1024%26id%3d%257bCBAC3403-1C74-E011-8947-1CC1DEE8DAD5%257d%26rskey%3d37636470&pagetype=entityrecord
- Linking to a Microsoft or other Internet page for documentation, supplemental training materials and so forth. This is essentially the example shown above.
- Linking to a Web Resource HTML page contained in a Dynamics CRM 2011 solution.
Use your imagination and creativity, but be aware of the following caveats:
- Hyperlinks in dialogs cannot be created dynamically in the current release.
- Users must have permissions to view the hyperlink, and since the hyperlink is external to Dynamics CRM, it would be easy to include a link some users could access and others could not. For example, permissions in SharePoint and Dynamics CRM are managed separately, so you cannot assume that any user with permissions in CRM to run a dialog process will have access to a SharePoint URL you provide as a hyperlink.


Building Business Processes in Dynamics CRM 2011: Installment 6 Said,
July 27, 2011 @ 8:15 am
[...] #2: Prompts and Responses in Dialogs [...]
November 2011 Service Update – Business Process Improvements Said,
October 28, 2011 @ 4:40 pm
[...] a detailed explanation of the pre-R7 response type options, read this article. Here let’s focus on the new ones, starting with the easy ones: Date and Time, and Date [...]
November 2011 Service Update – Business Process Improvements - Richard Knudson’s Microsoft Dynamics CRM Trick Bag - CRM Technical Blogs - Microsoft Dynamics Community Said,
October 28, 2011 @ 5:40 pm
[...] a detailed explanation of the pre-R7 response type options, read this article. Here let’s focus on the new ones, starting with the easy ones: Date and Time, and Date [...]