A business rule is associated with an entity, and it is not uncommon in projects to have a number of business rules that you want to run in a certain order. For example, you may have the following business rules in Account:
- Set Territory, to help set Territory lookup field based on entered Country field (e.g. if Country is “Australia” or “New Zealand”, set Territory to “Australia – New Zealand”).
- Check Territory, to check if the Country and Territory values is a valid combination.
Unfortunately, despite of various improvements Microsoft has made since the initial release, there isn’t yet a proper way to specify Business Rule execution order in Dynamics CRM. In fact, when you deploy the business rules above, “Check Territory” will execute before “Set Territory”, and potentially result in errors.
A workaround is to manually deactivate these business rules and re-activate them in the correct order, but this is not an ideal approach.
Another more effective workaround I’ve found is to prefix the names with numbers to reflect the execution order, e.g. “01 Set Territory”, and “02 Set Territory”. Although not officially documented, I’ve found that when deployed to another environment, Microsoft Dynamics CRM activates business rules in alphabetical order, so business rules numbered correctly will be executed in the correct order.