Dynamics CRM 2011 Dialog Process Conditional Branches/Paths

Paul Nieuwelaar, 10 January 2012

In a couple of my last blog posts, I’ve looked at the updates to Dialogs in Rollup 5, and also how to query data from within a Dialog. In this post I will be showing how to use conditional branches/paths in a Dialog. In other words, how to change the upcoming prompts based on the responses of the previous questions.

Below I have illustrated a reasonably complex Dialog structure, the diagram is created in Visio, as it can be good to get the underlying structure down first:

 Dynamics CRM 2011 Dialog Process Conditional Branches/Paths

As you can see there are several different paths that the dialog can follow. In this particular example, we are assuming that a Lead has enquired about a product, and we are now following up as we haven’t heard from them in a while.

The process starts by confirming they’re still interested in the product, if not we disqualify the lead and end the call. Otherwise, it asks if they are still with the same company, or if one isn't yet set it asks them, and then updates the Lead.

The next check is if they want to buy the product now, if yes payment instructions will be sent. If no, a demo of the product is offered.  If they don’t want a demo they are asked we can follow up with them again, which will create a phone call activity, and then end the call.

Rather than creating each step of this Dialog, I’ll show how to set some of the conditions, and view the final result. In some places there are multiple paths that end up in the same place (for example if there is no Company Name on the lead or if their Company has changed it will ask them for the Company Name).

 Dynamics CRM 2011 Dialog Process Conditional Branches/Paths

Firstly, to create each conditional branch, start with a check condition. In this case we are checking if the Company Name field contains data.  We need to say ‘if the Company Name has data, go to the page to ask if they are still working with that Company’. Then without using a conditional branch off that check condition, we can instead add another check condition to see if the answer to the previous question was not ‘Yes’. In both cases where they have changed their Company, or where one was not originally set, the next page asking for their Company Name will be shown.

There is one issue, if there is no Company Name set, it will skip the question asking if they’re with working with their company all together, so the check for ‘not Yes’ wouldn’t be available. Don’t panic! Using Global Variables we can create a variable at the top of our Dialog called ‘IsSameAccount’, with a default value of ‘No’, assign the value from our first question once it has been answered. This will allow us to use our same condition again.

 Dynamics CRM 2011 Dialog Process Conditional Branches/Paths

The Global variables can be added in the Variables section above your steps, and values can be assigned to the Variable using the Assign Value step. You can check the value of the global variables in check conditions, using the local value ‘Dialog’, and the Variable Name.

1. Adding the Variable:

Dynamics CRM 2011 Dialog Process Conditional Branches/Paths

2. Assigning a Value (under Add Step):

Dynamics CRM 2011 Dialog Process Conditional Branches/Paths

3. Check Condition for the Variable:

 Dynamics CRM 2011 Dialog Process Conditional Branches/Paths

You may have noticed that using check conditions and resulting actions (such as sending emails or updating records based on responses)  will mean that each Page in your Dialog will probably only have 1 question/prompt. This means that you will need to click ‘Next’ after responding to each prompt; this is a small sacrifice to make to be able to have contextual dialog branches/paths.

I’ve added the full Dialog steps below, which you can use to fully understand how the process illustrated at the beginning works. If you would like to try this Dialog for yourself to understand and work through each step, contact us or leave a comment below and I will e-mail you the solution containing the Dialog.

 Dynamics CRM 2011 Dialog Process Conditional Branches/Paths