Uncategorized

OR Statement Workflows in CRM 2013, Spring Wave Release – New functionality

One of the new features of CRM 2013 was the inclusion of Real-Time or Synchronous Workflows, this gave CRM customisers the ability to trigger a Workflow which would run instantly with out having to write Plugin automation/JavaScript. To put this into context – if a user updated a field on a record, this update would trigger a real time Workflow (defined in the activation criteria)  and could update a field on the form in real time without refreshing the page.

For further information about Real Time (Synchronous) Workflows, a blog written by Steven Foster can be found here:

https://community.dynamics.com/crm/b/nakedcrm/archive/2013/09/11/crm-2013-synchronous-workflows-real-time-workflows.aspx

Now, Microsoft has gone one step further and has  implemented one of the most requested features missing from Workflow in CRM with the Spring Wave release for Microsoft Dynamics CRM 2013.

I introduce you to the ‘OR’ statement.

The OR statement has finally been added as part of the conditional criteria for Workflows, just like it is included in the Advanced Find functionality which lets users build up their required lists and views of data based on conditional logic.

For example, a user has the requirement “Show me a list of Accounts which have the word ‘Hospital’ or ‘Clinic’  contained in the name (I have omitted Status in this example):

OrAF1

When building a Workflow, the customiser needs to define  four certain aspects:

  • When to start them?
  • Should they run as a background Workflow or a real-time Workflow?
  • What actions should they perform
  • What conditions should the actions perform?

(For further information about these aspects can be found in the Help section on technet http://technet.microsoft.com/en-us/library/dn531067.aspx)

I am now going to focus on the last aspect “What conditions should the actions perform?” by using an example and including the OR statement and where/how it can be used.

Example:

For each “Active” Account record in CRM, if the Name contains either ‘Hospital’ or ‘Clinic’ or ‘NHS’ then update the Parent Account lookup field to an Account called = ‘National Health Service’ (a fairly useless requirement but will serve the purpose for our example).

Previously in CRM, we would have to build up conditional logic with multiple conditional branch’s (‘Check Condition’s) and record updates. It would look something like this:

Or2

It can be seen there is no ‘OR’ statement and conditional branching was the only was to achieve this conditional logic:

  • IF the Account Name contains Hospital then Update the Account
  • Otherwise IF the Account Name contains Clinic then Update the Account
  • Otherwise IF the Account Name contains Hospital then Update the Account
  • Otherwise stop the Workflow

Either three separate update steps to the Account are required to perform the Parent Account update or a single child Workflow (performing the Account update step) will need to be triggered 3 times (one for each conditional branch).

Logically, the Workflow performs a check  on the first ‘Check Condition’; if the record matches the criteria the Workflow executes the update step, if no match is found the workflows proceeds to the next conditional ‘Check Condition’ and checks the criteria and so on. If no match is found in any of the branch ‘Check Condition’s, the Workflow is completed.

Performance wise, this takes the Workflow longer to run as it has to run against each ‘Check Condition’ in order, until a match is found; for Accounts with the Account Name containing ‘Clinic’, the Workflow performs 2 additional ‘Check Condition’s than for an Account with the Name containing Hospital.

The OR Statement.

Microsoft allows us to perform the 3 ‘Check Condition’s above in just 1  ‘Check Condition’ using the “Group OR” button.

This allows us to group checks together with either an “AND” or an “OR” statement.

Or1

 

Now we can build a Workflow that can perform all the conditional ‘OR’ checks in one ‘Check Condition’.

Or3

 

In theory, this should increase the performance of the Workflow as it only needs to perform 1 Check Condition and 1 Update step, although it will take slightly longer to perform the check condition. From a customiser point of view, this has saved time constructing these types of Workflows as it reduces the number of Conditional Branch’s and Check Conditions we need to input which we previously had to build.

If you have updated your CRM 2013 Organisation (either On Premise or On-line), you can now have fun transforming your existing Workflows which use the Conditional Branch logic to create ‘OR’ statements into actual ‘OR’ Statement Workflows!

Thank you for reading and I hope this blog helps!

 

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s