Dynamics CRM 2016 Business Rules invoked by Business Process Flows

David Mochrie, 21 December 2015

Dynamics CRM 2016 is here and with it comes some exciting new features. One useful feature is the ability to invoke a business rule based on business process flow properties. Before we dig into this in more detail, let’s just review what a business rule and a business process flow are.

A business rule is form-based logic where system administrators and customisers can set form actions such as making a field visible or required based on, say, a value in another field. These actions happen on the form instantaneously, without the user having to save the record. Before business rules were introduced in Dynamics CRM 2013, such things were handled by JavaScript. You access them through the customisations module, either through an entity itself, or through the form in an entity.

image

A business process flow, or BPF for short, also introduced in CRM 2013, is the very distinctive process bar which appears across the top of the form for some entities as standard (case and opportunity are examples), and can be configured for other standard or custom entities:

image

These BPFs allow a user to track a business process through CRM, possibly across multiple different record types to come to some business outcome. The have stages, such as ‘Identify’, ‘Research’ and ‘Resolve’ on the out of the box phone to case process, and each stage can contain many steps.

Until Dynamics CRM 2016’s release, if you wanted to invoke a form action (e.g. set a field to required) when a BPF was set on a record, or a stage of a BPF was reached, you had to this with Javascript. With the introduction of CRM2016, you can now do this with a business rule. This takes it out of the realm of the developer, and into the realm of the system administrator or customiser.

Let’s take a look at how this could work.

Let’s say you have 2 BPFs on opportunities, 1 for international sales and one for domestic. The default is domestic, as that is the most common type of sale for this organisation. There is a field on the form called ‘Exporter’ which is a lookup to the account that will be handling the shipping of this sale. This field is hidden on the opportunity form by default, as an exporter is not applicable if the sale is domestic. However, when the BPF for international sales is selected, you want the ‘Exporter’ field to become visible. You would configure this in the business rule as follows:

Select the ‘Field’ in the ‘Condition’ part of the business rule as ‘Business Process’. You also select either ‘Value’ or ‘Value with Stage’ to set whether the business rule is invoked by either the business process itself being selected, or a particular stage of the business rule being selected. In our example, we only need to select the ‘Value’ as we are invoking the business rule regardless of stage.

imageIf the business rule was dependant on a particular stage being the active stage, you would select ‘Value With Stage’ which brings up another clause in the condition for you to specify the stage:

imageAs you can see above, you also get the option of setting the stage as the ‘Selected Stage’ rather than the active stage. ‘Selected Stage’ the business rule if you are in the record with the business process on it and you simply click on the stage, rather than advance the business process to that stage by clicking next stage, as per the screenshot below:

image

I can’t think of any situation where this would be needed, but it’s sure to come up sometime, so it’s useful to have the functionality there.

The other option you have is invoking the business rule if a particular stage category is set:

image
The stage category is a global option set and is an optional value to add to a BPF stage. It is useful for grouping multiple BPFs together for reporting purposes. Below you can see where it is included on the BPF:

image

So, if you have multiple BPFs with different stages but the same stage categories, you could invoke the business rule by setting the stage category in the business rule.

The rest of the business rule configuration is as per normal, i.e. setting the action to be performed by the rule, in this case, setting the ‘Exporter’ field to visible.

So, when you’ve finished the business rule, it will look like this:

image

This functionality is yet another step away from development and towards configuration. It will empower system administrators and customisers to create even better solutions for their end users faster and cheaper than ever before.