{Dynamics CRM 2015}Why are my Business Rules not executing on the server side

Exploring the new features that came along with Dynamics CRM 2015 is fun indeed and what can be more fun than getting a chance to implement that in real time project. While going through the new features sometimes we tend to miss out on the small nuances that would actually make the new stuff to work as you like. And this is what exactly happened with my colleague.

So this is what he did. He had a workflow which when fired would create a contact. In the contact, he defined a business rule that would throw an error message if a particular business condition satisfied. For those who have not yet explored the new Business Rules feature of Dynamics CRM 2015 – With 2015 you can enable your business rules to fire from the server side also.

So my colleague was just joyous thinking about the fact that he no longer needed to write a plugin to do this stuff. Few clicks here and there and the job is done. However strangely enough even when the condition satisfied, there was no error and the workflow created the contact record.

So what went wrong here. Let’s see. For the blog since I could not present the actual situation of my client project, I would be just mocking up the scenario.

Let’s say we create a business rule which would throw an error message if the first name begins with D. No biasedness against people whose names start with D. Even mine starts with D Smile

Let’s see how the business rule looks like

image

 

Pretty simple. Isn’t it. Then I go ahead and activate it.

I have created a on-demand workflow which would create a contact with first name starting with D. Strangely enough when I run the workflow, the workflow is getting executed successfully and the contact is also getting created. So did my business rule not fire?

Time to get dirty. So let’s check our business rule again. When you create a business rule for an entity from form customization, the scope of it defaults to the default form for the entity.

image

To make the business rule fire on the server, you have to change it to the Entity. After I change it to entity and activate it and run the workflow again, I get the error and the contact is not created.

 

image

A small stuff but strangely enough many people forget while designing the business rules. Hence thought of sharing in case someone finds it useful.

Advertisements

Author: Debajit

I am a Dynamics CRM Most Valuable Professional (MVP) with 10 years of experience in Microsoft .NET Technologies and 7 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

5 thoughts on “{Dynamics CRM 2015}Why are my Business Rules not executing on the server side”

  1. i’m having a similar issue when creating a business rule (using entity) – when i execute a workflow to change the status reason (for example), and have a business rule (that runs on the server) that busienss rule doesnt fire once the workflow does its thing? Running Xrm.Page.data.entity.save() in js does not trigger business rules according to official docs – Do you know a clever work around?

  2. The only work around i had was to refresh the entire form using window.reload() or using: Xrm.Utility.openEntityForm… but I dont like page refreshes, would rather have somethign a bit more unobtrusive

  3. Hi,
    Thanks for reading my blog post.
    Can I have a little more information here.
    What are the condition of the business rule to fire. And is the workflow synchronous or asynchronous?

  4. Hi,

    What if I want my business rules to run both client side and service side. What configuration do I need to do to achieve this.

    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s