Workflow

Workflows are automated business processes that consist of Steps and Actions. A Workflow is an asynchronous processes; it doesn't require user input data. A Workflow can be triggered by an event (automated Workflow) or by a user (manual Workflow).

Note

Microsoft Dynamics CRM 2011 On-premises also supports custom Workflow Activities (like CRM 4.0) and custom XAML Workflows. An XAML Workflow can be visually designed and created in Visual Studio Workflow Designer, without coding.

Workflow versus Plug-ins

There are some major differences between Workflows and Plug-ins:

  • Workflows run asynchronously in the background. Plug-ins can run both asynchronously and synchronously.
  • Workflows can be triggered manually (security context of the user who trigged it), or automatically (security context of the workflow owner) by selected events. Plug-ins can only be trigged by the message (security context of the CRM Web application pool identity) for which they're registered.
  • Workflows provide the flexibility to allow admin users to change the business process without changing the code in Visual Studio. Plug-ins have to be recompiled by developers, using Visual Studio.
  • Workflows don't execute offline. Plug-ins support both online and offline execution.
  • Workflows don't support impersonation. Plug-ins do support impersonation.
  • Workflows can be paused, postponed, cancelled, and resumed. The workflow state is automatically saved before it is paused or postponed. Plug-ins execute to completion; the execution is required to complete its execution within a two minute time limit.
  • Workflows can be developed through the CRM Workflow web application, Visual Studio Workflow Designer (Custom XAML Workflows (on-premises only)) or Visual Studio (Custom Workflow Activities (on-premises only)). Plug-ins can only be developed through Visual Studio.

Workflows are based on the Windows Workflow Foundation 4. This uses the same event mode for Plug-ins. However, the pre-event doesn't support asynchronous processes. Choose Workflows when you require flexibility and user involvement. Choose Plug-ins when you require immediate platform response impersonation or "Pre-" events. Also bear in mind that Microsoft Dynamics CRM 2011 Online only supports the Sandbox Plug-ins and Workflows that are customized via the CRM Workflow web application (non-Custom Workflows).

A Workflow example

You might have noticed that the flight name is empty! We can simply generate the flight name from the Flight Number and Departure Time.

  1. Open the CRM web application, go to the ACM solution | Processes, and create a new process with the following information:
    • Process name: Update Flight Name
    • Entity: Flight
    • Category: Workflow
    • Type: New blank process
  2. Set up the Process properties as follows:
    • Process name: Update Flight Name
    • Activate As: Process
    • Scope: Organization
    • Start When:
      • Record is created
      • Record fields change (Flight Route, Departure Time)
  3. Add one step (Update Record | Flight), and then set the properties of the flight record:
    A Workflow example
  4. Save and activate the Workflow.

That's it. Now go ahead and add a new flight record (or update the on Flight Route or Departure Time for an existing Flight record); you will see that the Flight name is generated by the CRM workflow (after a few seconds). You can check the Workflow processes by clicking the Processes link in the workflow window.Alternatively, you can go to Settings | System Jobs in order to monitor a Workflow process.

In this example, we can see that the Workflow process is a system job (asynchronous operation) that is running in the background. The job owner (the running credential of this process) for the automatic Workflow is the Workflow owner (in our case). For the on-demand Workflow, the running credential is the user who triggers the process.

A Workflow example
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.188.238