POWEROBJECTS

718 Washington Ave. N. Suite #101
Minneapolis, MN 55401
View map and all Locations

Send us a message

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.

customizing

The new functionality in CRM 2013 Business Rules has become a go-to feature for replacing JavaScript. Where in the past, small client side requirements such as showing and hiding fields, defaulting values or making fields required would have required a developer to write JavaScript, now these can be done with business rules and no code!

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.

Let’s take a closer look at the setting of the Default Unit. What we are doing in this instance is specifying a record from the Unit of Measure entity to be set every time a user enters a new product. A very straightforward example that would have to have been done with JavaScript previously.

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=6.0.0.0, 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”>

  <ErrorCode>-2147220969</ErrorCode>

  <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>

  <Timestamp>2014-04-24T13:05:06.6094336Z</Timestamp>

  <InnerFault i:nil=”true” />

  <TraceText i:nil=”true” />

</OrganizationServiceFault>

 

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.

Happy CRM’ing!

Avatar for JoeCRM

JoeCRM

Joe CRM is a CRM superhero who runs on pure Microsoft Dynamics CRM adrenaline. As the face of PowerObjects, Joe CRM’s mission is to reveal innovative ways to use Dynamics CRM and bring the application to more businesses and organizations around the world.