Enhanced Business Rules: Houston we have a problem!

Since January our company is building a new solution on Dynamics CRM 2015. A very complex application to solve complex problems for large enterprises, and that can be hosted on both CRM online and CRM 2015 on-premise. Within this solution we are relying on the enhanced business rules that were introduced in CRM 2015.

In my opinion enhanced business rules are the best thing since slided bread  . Finaly our data is protected on both form level and on entity level. This means that every change we make to the data through the SDK is done against the set of rules we defined on the entity.

During our development process we are working in a DTAP environment, meaning that our solution gets deployed on a daily basis from development to test etc. We export our solutions as managed solution from our development environment, and import it later on in our testing environment etc.

Things seemed to work fine, until recently. Out of the blue our business rules started to behave in a non consistent way. Rules were firing in a different sequence etc. This worried us, since we have over 130 complex enhanced business rules helping us to build our application logic…

One of my colleagues, responsible for the functional side of things, decided to investigate what business rules were present. She was shocked as it turned out that all ehanced business rules were duplicated multiple times.

I decided to do a small test, which I will describe below:

Start with a clean solution

For my investigation, I created a new solution with a custom entity. On that custom entity I defined a value field. On that value field I implemented two enhanced business rules (rule scope set to Entity). I saved, published and activated the rules.  So far so good…

Export the solution / Import the  solution

I exported the solution as a managed solution, and removed the original unmanaged solution.
Then I imported the managed solution, and performed an advanced find to see what business rules where present.

B1

Search “Processes”, filter on Categoty equals Business Rule AND Primary entity equals [Entity Name]

Executing the query, gave me the following results:

B2

I retrieved the two rules, I defined on the entity. Both were inactive and I activated them. For some reason the business rules were doubled!?

B3

I selected all rules, deactivated them, reactivated them  for a couple of times…. I ended up with more and more business rules (at every activated one new instance per business rule appeared)

B5

*WUT?!*  This is not good at all! This probably explains why the business rules in our product are behaving in a non consistent way (as we speak we are working on a workaround for this problem).

Anyway, I decided to delete the additional set of business rules, after all I only need one instance of a rule. I selected the rules and deactivated them.

B6

I pressed the delete button, and was confronted with an error message.

B7

Translation: “An error occurred. The selected action has not been completed for one or more records”. A number of instances had been dropped.

B8

When I select the deactivated instance of the business rule and try to delete it, I get confronted with the following error message:

“The object you tried to delete is associated with another object and cannot be deleted.”

Borked up!

Things get worse from here…. When I want to remove my solution, I get the following error message:

B9

Translation: “SdkMessageProcessingStepImage cannot be removed because this is needed for one or more parts”.

I decided to deactivate the two remaining business rules and to delete them. That seemed to work.

When I do another attempt in removing the solution, I get confronted with another error message:

B10

I got stuck. I have a solution that I cannot remove…

I think we might have found a bug….. Houston we have a problem!

4 thoughts on “Enhanced Business Rules: Houston we have a problem!

  1. Amigo says:

    Have you solved this issue?

    • Hi Amigo,

      Unfortunately not, we had some long calls with Microsoft support, but ended up in resetting the environment and building it up again from the ground.

      I still have to test if the issue has been resolved in CRM 2016

  2. Anwesha says:

    HI,

    We are facing the same issue with CRM 2016 online version. Have you been able to find the root cause for this?

    Regards,
    Anwesha

    • Hi Anwesha,

      that’s a pity to hear. Did you try to deactivate the enhanced business rule, then remove it by hand. Once that succeeds, you can do whatever you want with the entity.

      I hope this helps you a bit

      Bas

Leave a Reply

Your email address will not be published. Required fields are marked *