In my last blog post, The Real Power of Real Time Workflows in Microsoft CRM 2013 – Part 1, I highlighted how real time workflows could be used to enable rapid data entry.  In Part 2, I’m going to review how this powerful tool can be used to enforce complex data validation rules.

Real World Scenario

The best way to describe this is through a real world example.  Company A is using the Task activity entity to keep track of their employees time spent on Cases.  They have created a Time Category field that will allow their employee’s to track the specific category of time being entered by the employee – they fall into three categories: On-Site, Off-Site or Support.  However, they are looking to implement a business rule that enforces a minimum time value for On-Site cases, which ensures that it is never less than the total travel time required – this is a variable value that gets stored on the Account record – a completely different entity!

Typically, a requirement like this – incorporating a validation rule one entity based on the data of a related record, in real time – would have taken hours of coding, using either complex javascript or a plugin.  Fortunately, with Real Time Workflows in Microsoft CRM 2013, we can handle this in minutes, without writing a line of code!

How It Works

Below, take a look at the Travel Duration field on the Account record – and the Time Category and Duration field on the Task activity record.

Real time workflow image 1

Defining The Workflow

To enforce this rule, I start by building a workflow against the Task entity.  Since I want this rule to be enforced when the user tries to close the activity, I set the triggers to both On Create, as well as on Status Change.  I also need to make sure that the workflow is set to Real Time.  And then, I add the necessary conditions to ensure that we only throw an error when the:

  • The status is set to completed
  • The Time Category is set to On Site
  • The Duration of the Activity is less than the Travel Time stored on the Account

Real time workflow image 2

And finally, the magic comes in the final step – under my condition, I add a Stop Workflow action and set the Status to Canceled.  By clicking Set Properties, I can deliver a specific error message to the user, communicating exactly what went wrong with their time entry.  I can even dynamically reference data form the Account record to let them know what the specific minimum for the Account they’re working with is!

Stop Workflow Action Screen

See It In Action

Now, let’s take a look at what happens when I enter a Task with a Duration less than the Travel Time for MIBAR.net.

Real time workflow validation

Beautiful – it works just as we expected.  When I try to complete my Task with a Duration less than the Travel Time on the Account, CRM stops me – and also provides me with a detailed explanation for how to correct my issue.  With some creativity, this can be extended to accommodate numerous scenarios across your business.  There you have it – cross entity data validation without a line of code!

If you have any questions – or would like to discuss ways that you can improve the way you’re currently using Microsoft CRM, please feel free to schedule a free consultation with one of our CRM experts!

Additional Microsoft CRM Resources

Microsoft Dynamics CRM Free Consultation

Salesforce Skews Truth In Battle Against Microsoft CRM

Wait! Before You GoWould you like to talk to a business software expert to answer your questions?

When you schedule a free consultation with MIBAR, you will experience a one-on-one conversation with a business technology expert who is passionate about understanding your unique needs or issues. Schedule a free consultation today at the link below or give us a call at (212) 869-9300.

Learn More