Business Rules between Development and Production

Quick intro :

The business rules were introduced with the CRM version 2013. Very useful to customize the system without special developing knowledge. So in the first approach i would say : really cool !

We usually use it to do small client side requirements such as setting a default value to a field, hiding a field , make a field optional or required, and so on...

Example :

Example i faced recently was to set up default values for new product creation where i simply want to auto fill the Default Unit and Primary Unit fields if they don't have any data:

So far so good you will think, everything works on your development system, you are ready to export your solution containing the business rules and import it on your productive environment.
But if you do so, you will face this kind of error on your productive environment :

<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">  
  <ErrorCode>-2147220969</ErrorCode>
  <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>uom With Id = 56911647-f348-4698-a968-060474b65e77 Does Not Exist</Message>
  <Timestamp>2016-01-14T08:26:11.7262788Z</Timestamp>
  <InnerFault i:nil="true" />
  <TraceText i:nil="true" />
</OrganizationServiceFault>  

Would be too easy if you weren't not facing some problems at some point with our beloved CRM :-). Don't worry, this isn't the kind of error you need 4 days to fix. The solution here is really simple, we will have to redefine the business rules with the "local" values of the production environment.
To quickly explain why it's crashing, when you create a mapping of values like we did on an environment A, it's using the GUID of the record coming from the database of the environment A. Since in our case, the Default Unit is automatically created when you install your CRM, the GUID are differents.
If i get back to the error message, the key information is : uom With Id = 56911647-f348-4698-a968-060474b65e77 Does Not Exist

Time for the solution steps :

  • Deactivate your business rule
  • Empty the value of the field with an issue :
  • Put the value back (which will use the GUID of the current environment :
  • Do it for the other fields if there are any
  • Save & Activate the Business Rule
  • And Voila !

Your business rule is working again on your productive environment.
See ya.

Clement

Read more posts by this author.