Microsoft Dynamics CRM 2013 – Real-time Workflows


Real-time workflows are a new feature in Dynamics CRM 2013. Concepts required to understand Real-time Workflows:

In this post:

Real-time Workflows

Infinite loop detection

Real-time workflow activation

When to use Real-time workflows?

Converting between real-time and background workflows

Initiating real-time workflows before or after status changes

Real-time Workflows

  • Real-time workflows run immediately (synchronously) as soon as the event is raised

  • They do not allow for wait conditions. Since they execute in the synchronous fashion they cannot wait for any periods of time

  • Background workflows can be converted to real-time workflows as long as they do not use wait conditions

  • Real-time workflows support pre and post pipeline stages (can additionally be configured to be run before or after certain events)

  • Real-time workflows can be executed in one of the two different security contexts:

    • Owner, or

    • The user who made changes to the record

  • To activate real-time workflows a user must have the Activate Real-time Processes privilege

  • Real-time workflow run in the same transaction as the event that they are being triggered for. So if there is any errors or issues the entire operation will be rolled back. This is in consistency with the plugins development.

Additionally,

  • Simple validation scenarios can be met with these real-time workflows because we can execute our conditions and actions in the pre-stage of the pipeline

  • Reduces dependency on writing synchronous plugins for enforcing different business processes

  • Saves effort that goes behind maintaining the code base for a plugin

  • Allows non-technical users to be able to enforce complex business processes without writing any code

Infinite loop detection

If there is a situation in which a workflow is executing within a short period of time more than eight times then the infinite loop detection would kick in and prevent any damage to the server resources as well as performance overhead. Workflow failure will also specifically state that the workflow job was cancelled due to the fact that the workflow had started an infinite loop.

Real-time workflow activation

After the activation the real-time workflow will be registered as a step in your SDK message processing and plugin will get fired during the main operation then. The step gets deleted as soon as the workflow gets deactivated by the user.

When to use Real-time workflows?

  • Real-time workflows should be used with care

  • Background workflows are generally recommended because

    • They allow the system to apply them as resources on the server are available

    • Help maintain the best performance for everyone using the system

    • They are fine for most automation of business processes because the people using the system don’t need to be consciously aware that the process is running

  • Background workflow drawback

    • Actions defined by background workflows are not immediate

    • Generally take few minutes to apply the workflow

  • Use real-time workflow

    • When a business process requires someone to immediately see the results of the process

      • For example, you want to set certain default values for a record the first time it is saved

      • Or you want to make sure that some records are not deleted

    • If you want the abilityto cancel an operation

Converting between real-time and background workflows

  • You can change a real-time workflow into a background workflow by choosing Convert to a background workflow on the toolbar.

  • You can change a background workflow into a real-time workflow by choosing Convert to a real-time workflow on the toolbar.

    • If the background workflow uses a wait conditions it will become invalid and you won’t be able to activate it until you remove the wait condition.

Initiating real-time workflows before or after status changes

  • When you configure Options for Automatic Processes for real-time workflows, the Start When options for the status changes event let you select After or Before for when status changes. The default option is After.

  • When you select Before you are saying that you want the logic in the workflow to be applied before data changing the status is saved.

    • This provides you with the ability to check the values before other logic has been applied after the operation and prevent further logic from being performed.

Using the Stop Workflow action with real-time workflows

  • When you apply a Stop Workflow action in a workflow you have the option to specify a status condition that can be either Succeeded or Canceled.

  • When you set the status to canceled, you prevent the operation. An error message containing the text from the stop action status message will be displayed to the user with the heading Business Process Error.


Reference:Microsoft Dynamics CRM 2013 Implementation Guide

Video: Real Time WorkFlows CRM 2013

(The video is although in Russian language, but while watching it you will somehow get the idea behind the Real-time workflows.)

Advertisements
Tagged with: , , , , , ,
Posted in Dynamics CRM, Dynamics CRM - Customization and Configuration

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

%d bloggers like this: