We’ve already covered how to become a pseudo-developer with business rules in CRM 2013. Today we will talk about moving business rules with static values from development to production.
A common scenario for the use of business rules is to default values on the form. In our case, see where we user a business rule to automatically set the Default Unit, Decimals Support and Unit Group on the product form.
So, we have fully tested our business rule and are ready to move it to production! If you need help with this, reference our blog on solution management and best practices.
Now, let’s say you’ve moved your solution to production and you go for a test run and BAM! Error!
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: uom With Id = 3016b890-dafd-437a-8094-8f910666a1b4 Does Not ExistDetail:
<OrganizationServiceFault xmlns:i=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://schemas.microsoft.com/xrm/2011/Contracts”>
<ErrorDetails xmlns:d2p1=”http://schemas.datacontract.org/2004/07/System.Collections.Generic” />
<Message>uom With Id = 3016b890-dafd-437a-8094-8f910666a1b4 Does Not Exist</Message>
<InnerFault i:nil=”true” />
<TraceText i:nil=”true” />
What happened? It’s a simple solution, all we’re doing is defaulting a couple fields. What could have gone wrong?
Here’s the catch. When you create a business rule that contains reference to a specific record (in our case the Primary Unit record in the Unit of Measure entity), the business rule is referencing the guide for that record that exists behind the scenes in the database. When we move our business rule from development to production, the business rule is still referencing the guide from development. Hence the error: “uom With ID = XXXXX Does Not Exist”.
So, to fix this issue, simply:
1. Go into the business rule in production and deactivate the rule.
2. Delete the Primary Unit in question from the Value field.
3. Then re-select the Primary Unit.
That’s it! Save and activate and you’re all set. Now that you know what to watch for when moving business rules from development to production, check out previous posts on what other cool things you can do with business rules.