The Microsoft Dynamics CRM Team Blog
News and views from the Microsoft Dynamics CRM Team
When using Microsoft Dynamics CRM have you ever wondered how to create and use formulae in Dialogs? Yes this is possible using two features supported in Dialog Processes: Variables and Assign Value step. If you look at the Dialog designer page, you will see a section for creating Variables as shown in figure below.
You can add Variables with default values using this step. The Variables can be later used to create formulae in your Dialog. Three types of Variables are supported by Dialog: Single Line of Text, Whole Numbers and Floating point Numbers. Once you click on Add you will get a Dialog for defining the variable as shown in below figure.
Once the Variable is defined it appears as below figure on the designer.
You can Edit or Delete the Variables after it is defined. You can modify the name and default value of the Variables. However you cannot modify the data type of the Variables once defined. This limitation is to avoid data type mismatch errors. Suppose if some variable is defined as floating point number and used to create formulae in Dialog Process and later the variable’s data type is changed to Text then the steps using the Variables for multiplication or addition would become invalid.
Now once your Variables are defined, you can use them to create a formula using Assign Value step which is available in Add Step menu on designer.
Once you click the menu option you will see Assign Value step on the designer where you can fill the name of this step. You can use Set Properties button to create the formula. The step looks like below figure on designer.
Once you click the Set Properties button a formula definition Dialog will appear. The Variables defined in the Dialog will automatically appear in the Name dropdown.
Assign Value step supports different kind of Operators for all data types supported. For example; following table illustrate the operators supported for different data types.
Single Line of Text
Set to, Append with and Clear
Set to, Increment by, Decrement by, Multiply by and Clear
Floating point Number
Let us now develop a Dialog for Lead Qualification. Suppose your company is running some marketing campaign through phone call. Assumption is that the phone call records already exist with Regarding field as Lead and Recipient also as Lead to whom call has to be made. The marketing executive is running Dialog to achieve the objective. For this we need to author a Dialog. We will create a Dialog for Phone Call entity so that while making an outbound call, the Marketing executive directly launch the Dialog from Phone call page and start the Dialog for conversing at phone with the probable Opportunity. In order to simplify the example we will assume that the customer will be asked 2-3 questions in order to qualify the lead as Opportunity or lost Lead. First we have to plan the Dialog. For simplicity, we have very limited set of questions to qualify the Lead as shown in below flowchart.
Step 1 of this flowchart can be implemented with Assign Value step where the name variable is Set To regarding Lead’s First name data slug which is illustrated in one of the above figures. The variable initialized with First Name can be used in a Prompt greeting customer as shown below.
Now you have to check if the customer is further interested in continuing the talk. If yes then we will increment the value of current_score by 5 as per flow chart shown above and continue with other steps as per flow chart in the if-then block. To increment the value of current_score by 5 we would do following.
First select the variable ‘current_score’ from name dropdown, ‘Operator’ as ‘Increment By’ , then type ’5.0’ in the ‘Default value’ text box and finally click Ok on the Form Assistant.
In case user is not interested then we would deduct the 10 points from the current score as shown below.
Now you get how to create formulae in your Dialog. The final Dialog will look something like shown in below figure.
In above Dialog, you will notice that you can change the status of Regarding(Lead) to Qualified however the Process (Dialog or Workflow both) does not provide option to convert this Lead to Opportunity or Account. That can be achieved by placing two Create Record steps, one to create Account with the Lead’s company’s name and other to create an Opportunity with the same topic as that of the Lead as shown in following figures.
Create Account step would be configured as shown in below figure and the same account can be used as potential customer for the Opportunity created due to Lead qualification.
Obviously the Created Opportunity should have same topic and customer created in previous steps which is simple as shown in next figure which you get on clicking Set Properties button of Create Record step.
Finally test the Dialog after activating it to verify that if the Lead is qualified the corresponding Account and Opportunity are created.