New Conditional Statements Microsoft Dynamics CRM 2015 Business Rules

Paul Nieuwelaar, 25 September 2014

Business Rules were introduced in Dynamics CRM 2013, which allowed customizers to create simple conditions to manipulate the form without needing to write any JavaScript. The only limitation of this was that to create If-Then-Else style conditions we had to create multiple business rules to accommodate each possible scenario.

Dynamics CRM 2015 now introduces the ability to add additional conditions into a single business rule, allowing us to maintain all the logic for a single rule in one place, rather than across several business rules.

New Conditional Statements Microsoft Dynamics CRM 2015 Business Rules

You can see we now have a button at the bottom ‘Add Else’. If we click this a new CONDITION/ACTION block will be added.

New Conditional Statements Microsoft Dynamics CRM 2015 Business Rules
We can leave the CONDITION blank, and this will act as an ELSE, meaning if the first condition is not met, this action will fire no matter what. Otherwise if we specify a condition, this will become an ELSE IF, and we will have the option to add an additional ELSE below this.

New Conditional Statements Microsoft Dynamics CRM 2015 Business Rules

We can repeat this as many times as we need to, creating as many ELSE IF’s as is required for this rule. I’ve added a few more conditions for if the Rating is ‘Cold’ to set Probability to 20, and finally an ‘ELSE’ which sets it to 0 if there is no Rating set for some reason.

Once we’re done we can activate the rule and test it out.

New Conditional Statements Microsoft Dynamics CRM 2015 Business Rules

When creating a new Opportunity, straight away we can see the Probability is set to 60 since the Rating is Warm by default.

New Conditional Statements Microsoft Dynamics CRM 2015 Business Rules

If we change the Rating to Hot or Cold the Probability will be updated based on our rules.

New Conditional Statements Microsoft Dynamics CRM 2015 Business Rules