Trigger Business Rules from Business Process Flow – CRM 2016

Though we did had both Business Rules and Business Process Flow in CRM 2015 as well, but there was no way to invoke a Business Rule for some action happening on Business Process Flow. Thus if I was required to perform a simple operation of locking a case type field when case stage changes to Research, I was required to have a JavaScript instead of using a no code approach of using business rules.

But now these kind of requests can be achieved using combination of business process flow and business rule. While creating a Business Rule, we have an option under ‘Field’ to select a ‘Business Process’. This allows two kinds of checks to be performed:

  1. Check for what business process flow is being used.

  2. Check based on field stage (Active/Selected) of business process flow.

This helps in completing above mentioned scenario and similar other requirements without writing a JavaScript.

Advertisements

Business Rules in CRM 2015 – What should one know?

I came across a new thing about Business Rules in CRM 2015 which I was not aware of. While working on JavaScript to hide a section OnChange of a field, I ran into an issue where the section was not getting hidden on change of field value. After few minutes of debug and then bit research, found that JavaScript runs before business rules. In my case, below was the scenario which caused the trouble:

I had two sections, A and B. One field “Record Type” from section “A” had Business Rule on it which hides a field “Field 1” which is in Section B. Then I had a JavaScript which triggers OnChange of “Record Type” field and hides “Section B”. As JavaScript triggers before Business Rule, JavaScript use to hide “Section B” after which Business Rule used to show the complete “Section B” again and hide only “Field 1” mentioned in business rule.

Below are few more things one should know about Business Rules in CRM 2015:

•    The rules need to be activated before they take effect (similar to workflows).

•    You can specify whether the rule applies to all forms or specific forms.

•    The rules fire in the new mobile client for iPad and Windows 8.

•    The rules are client-side rules, they do not fire during API calls, data import, etc. Microsoft’s vision is to add that support in a future release.

•    The rules do not support show/hide of Tabs and Sections. You either need to mention each field individually in your Business Rule or use JavaScript.

•    If your rule hides a field then CRM moves fields up to close the gap.

•    You need to consider the inverse of your rule i.e. in my example I tell CRM what to do when the Est. Revenue field contains data. I don’t tell it what to do when the Est. Revenue does not contain data. I need to write a second Business Rule for that.

•    JavaScript runs before Business Rules.

•    String comparisons are case sensitive.