The Dialog is a brand new feature built on top of Windows Workflow Foundation 4 in Microsoft CRM 2011. Before I delve into details of power, the Dialogs provide, this is important to let you know that now the Workflows and Dialogs are collectively known as Processes in Microsoft CRM 2011. In simple words a Workflow or a Dialog is a Process in Microsoft CRM 2011 which does a set of actions defined by the author of the Process. A workflow is a backend process to accomplish some task defined by Workflow author asynchronously whereas a Dialog is a frontend, interactive user interface based process which takes user inputs and then does the job synchronously as defined by the Dialog author. Just like its Workflow cousin Dialog also is based on Windows Workflow Foundation and can be extended by adding new Custom Workflow Activities supported by .Net 4.0.
Dialog is a frontend On Demand Processes which present the Prompts and Tips to the user running the Dialog through a nice user interface and can take inputs from the user for performing the predefined activities in background. It has a lot of capabilities, some new and some borrowed from existing CRM Workflows. Here is the list of what you can do with Dialogs.
1. Present a set of questions and capture responses from the customer. You can do this in CRM Dialogs using “Prompt and Response” steps. You can take responses in form of Textboxes (multiline and single line), one from the Option Sets(Radio buttons and Picklists). The responses can be of three types such as Whole Number, Decimal numbers and Texts. One or more “Prompts and Responses can be presented to customer on one Page.
2. You can create a link to a static web page, the link would appear on the Dialog page either independent or embedded as part of some Prompt or Tip Text. The option to define a web link comes on “Prompt and Response” designer page.
3. You can use CRM Queries (similar to Advance Find queries) to verify or to present the data of the customer. The queries can be parameterized also where you can construct the queries based on responses taken from customer. All these can be done using “Query CRM Data” step available in Dialog authoring page.
4. You can define Variables and construct Formulae to use in your Dialogs. To do this you need to use “Variable” or “Input Arguments” along with “Assign Value” steps.
5. You can delegate the job of performing some set of actions predefined in another Dialog or Workflow using “Link Child Dialog” or “Start Child Workflow”. The child Dialog will be a UI based frontend process which will take the control from parent Dialog whereas a child Workflow would do its job asynchronously while parent Dialog process is still running.
6. Like workflows, Dialogs also have capability to take a decision using “Check Condition” (if <condition is true> then <take following actions>), “Conditional Branch” (if <condition 1 is true> then <take following actions> else-if <condition 2 is true> then < take following actions >), and “Default Action” (if <condition is true> then <take following actions> else <take following actions>) steps.
7. “Stop Dialog” is provided to stop the Dialog run after the set of actions are taken from the decision taken as defined in above statement and the author of Dialog does not want to run the activities coming after Decision blocks. If “Stop Dialog” is not used then the activity following the decision blocks will resume after one of the decision block(Check Condition or Conditional Branch or Default Action) is run.
8. Other activities borrowed from Workflows are “Create Record”, “Update Record”, “Assign Record”, “Send Email” and “Change Status”. The only difference is that these actions are performed synchronously with the flow of Dialog unlike Workflows where these operations are handed over to Async Server.
9. You can write Comments, which can be later utilized, while Dialog is running.
10. You can use the Dialog Session information for analytics. Each time a Dialog is run, all the information such as customer responses, records created/updated along with comments written by user running the Dialog is recorded in Dialog Session record. Dialog Session entity has 1 to Many association with Dialog as well as Entity for which Dialog is created. Note that for privacy purposes you can turn off recording the customer’s response into Dialog Session while authoring the Dialog.
All above activities are available on the Dialog Designer out of box as shown in above figure. The users familiar with Workflow authoring can easily correlate to the available activities for Dialogs. The list above does not end with the out of box activities provided. Apart from the steps provided out of box, user can extend the list with the creation of Custom Activities using Windows Workflow Foundation just like Workflows. Please note that the only custom activities created using .Net 4.0 will work for Dialogs. We will try to cover that very soon.
In addition to above list, the biggest advantage of Dialog is that you can create or add the Dialogs as part of Solutions to deploy the Dialogs on new systems.
Before we start talking about the Dialog creation let us get ourselves familiar with the new changes in CRM 2011 for surfacing the Workflows and Dialogs along with few terms we will be using in our further conversation.
As I wrote in the beginning of this blog that the Dialog is a Process as the Workflow is. The same entity represents both, the Dialog and the Workflow. In fact the Workflow entity available in previous version has just changed its display name as “Process”. Only a new attribute with name “category” added to Process Entity decides whether a Process is a Dialog or a Workflow.
You can find the Processes under Setting tab in Web Application whereas under Setting folder in Outlook clients.
A Dialog is always created in the context of a CRM Entity. Once the Dialog is published and ready to run, the Dialog can be run only in context of a record of context Entity, as applicable to Workflows before.
In earlier version when you created a Workflow you just got a web dialog to fill the Workflow name and the context Entity. The same experience is still there for creating a Process. The only difference is now you have to choose whether the new Process you are creating is of category Workflow or Dialog.
The Category field has two options to choose from, “Dialog” or “Workflow”. Workflow Name is now changed as “Process Name”.
After you give these values and click Ok you will get a new web page as shown below. We call this as the “Process Designer”
The designer is the place where you author the steps to be performed by the Dialog.
Other changes happened in CRM 2011 are that now the “Publish” button on Workflow designer is changed “Activate”. Similarly, the “Un Publish” is now known as “Deactivate”. The effect of this change is that the Status of Processes can be Draft or Activated. A Process is in Draft state until you Activate it.
Now let us move to create our first Dialog.
In order to author a Dialog you would probably like to plan what the Dialog is going to do. Authoring the Dialog would come to next. And finally comes the testing if the Dialog is doing what was it planned to do. The same is reflected in following diagram.
1. Plan Entity for which Dialog is needed
2. Plan the steps which the Dialog would do when run
1. Create the Dialog for the planned Entity
2. Author the steps on Dialog Designer using the Steps available in Designer’s Add Menu
1. Activate the Dialog for Testing
1. Create a Test Record of the Entity
2. Test the Dialog by running the Dialog for the Test Record
3. If works as per plan leave Activated otherwise Deactivate and make correction.
You had a lot of patience! Now it’s time to create our first Dialog through Application in MS CRM 2011. The same can be created MS CRM 2011 SDK, however the Dialogs created through SDK would not open in designer, again as was the case with Workflows.
As the learning of all the programming languages starts with our familiar “Hello World!” program, we will start our journey with Hello World. Let us create a Dialog displaying “Hello World!”.
1. We need an Entity to create Dialog for. Let us take “Account” entity to do this.
2. We need to display “Hello World!” to the user running the Dialog. To do this we need
a. A Page where the “Hello World!” would be displayed
b. A “Prompt” which would be used to store “Hello World!”. Fortunately, Dialog provided “Prompt and Response” step to have no Response from user. If we set the Response Type as “None” then the Prompt would work as a message.
Here is step by step method to create our Hello World! Dialog.
1. Navigate to Processes folder under Settings
2. Click New, you will get a dialog to create a Process
3. Give Process a Name say “Hello World”, choose “Account” form the Entity drop down and “Dialog” from Category drop down as shown in following figure.
4. Click OK. You will get a designer page to define the Dialog Activities as shown in one of the above figures.
5. On designer, click on Add Step menu available on Designer and choose “Add Page”
6. You will get something as shown next
7. Now type the page description and select the row “Select this row and add click Add Step” written on designer. Then Click the Add Step menu and choose “Prompt and Response” from the menu as shown below.
8. You will see the result of previous step as
9. Click “Set Properties”, you will get a new web window to define the “Prompt and Responses”. Fill the values as shown in following figure
10. Since our Dialog is just going to display “Hello World!” so we do not need to set the Response Type other than “None” which is default value for Response Type. However you can explore the other options available in Response Type drop down and Data Type drop down. Data Type options are valid for other than “None” Response Type. More about the options of data types, response types and their usage in later blogs, for now let’s move to next step for our first Dialog. Click “Save and Close” and You will see the Prompt and Response defined on the designer as
11. Now Activate the Dialog by clicking Activate button available on Designer.
12. Your first Dialog is now Ready to Run.
Let us test it by running it with some Account Record context. For this you need to either select an Account record in the Account grid or open an Account record form. Let us try it from Account grid.
1. Open the Account grid in your CRM application and select a record in grid.
2. You can notice in the Ribbon “Start Dialog” button gets enabled.
3. Just click the Start Dialog button and choose the “Hello World” Dialog from the lookup.
4. Click OK to say the World “Hello!”
Wow! You are done with Hello World!
Let’s finish the Dialog session first. Click Next and you will get the last screen for this session.
The last screen is common to all the Dialogs you design to give the user option to go back on previous screen even after the actual last screen if the user wish.
So; are we done with our testing? Not yet! Unless we verify the Dialog Session to see if it has recorded the information captured during Dialog run. Let us now open the Dialog Session created for the run we tested. In order to do this open the Account record for which the Dialog was run. Yes you got it, the same record which you selected in Account grid before clicking “Start Dialog”. Click on the “Dialog Session” associated grid on the Account Record page as shown below and you will be able to see the Session record inside the associated grid.
Open the Dialog Session record visible in Dialog Session associated grid. It looks like shown below.
You can see the session information is recorded with all the information captured during Dialog run.
The Dialog Session record gets created as soon as you start running a Dialog. The progress recording could be seen by clicking “Summary” button on the window displaying the progress of Dialog run. Initially the Dialog Session is in “In Progress” state. If you go through the complete run of the session then the final state of the Dialog Session is “Completed”. And if you cancel the Run while session is still in progress then the state of the Dialog Session will be “Canceled”
Remember, if you cancel the Dialog Session you would not be able to resume it later.
We authored the Dialog and tested it too. Now I assume you have enough knowledge to start exploring the world of Dialogs yourself.
We will be coming up with detailed usage of various options and tips and tricks available in Dialogs. Till then try your hands on this powerful feature.
I am trying to write a dialog to enter a new Lead, but I want it to check for existing Accounts with the Company Name typed in.
I start with a Page asking for all the madatory fields ie Company Name, Contact Name yada yada
I then do a query to find any accounts with the company name entered
I then want the dialog to only create the lead, if the query returns no data.
It never seems to whether I type in a company that is an account or not?
I have tried to put a check condition and have said only create the lead if the Query dataset is empty.
I have also put a check condition to say that if it DOES have data, show it to be picked from. This ALWAYS runs and thenthen bombs out saying no records to display.
Some Screenshots here
What I guess I need is a proper example of something similar, do you know of one?
Very nicely and simply explained....
thanks so much.
Hi, is there any way how I can save comments from dialog to lead comment?
Thank you for answer.