Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Custom XAML Workflows for Microsoft Dynamics CRM 2011

[Applies to: Microsoft Dynamics CRM 2011]

On-premises Microsoft Dynamics CRM 2011 supports the ability to create custom XAML workflows. Custom XAML workflows, also called declarative workflows, allow you to harness the power of Windows Workflow Foundation to create reusable workflows for Microsoft Dynamics CRM. Using the Microsoft Visual Studio Workflow Designer, you can create workflows by dragging workflow activities from the toolbox onto the design surface, create variables, and set properties of these activities to implement the workflow’s functionality. You can use built-in Windows Workflow Foundation activities or the process activities that are specific to Microsoft Dynamics CRM. For information about the process activities in Microsoft Dynamics CRM, see the Activities namespace.

TipTip
The Developer Toolkit for Microsoft Dynamics CRM (on-premises) provides a streamlined experience for development of custom XAML workflows. For more information, see Create and Deploy XAML Workflows Using the Developer Toolkit.

Custom XAML workflows are not supported in Microsoft Dynamics CRM Online. This is because Microsoft Dynamics CRM workflows are not supported to run in sandbox mode, and if the custom XAML workflow contains malicious code, this can lead to data security issues.

After you have created a custom XAML workflow, you can import the XAML file into Microsoft Dynamics CRM, and use the workflow without compiling it. Moreover, you can export an existing workflow in Microsoft Dynamics CRM, edit the workflow definition (XAML) using the Visual Studio 2010 Workflow Designer, import the XAML back in Microsoft Dynamics CRM, and then use it. For more information, see Walkthrough: Modify an Existing Workflow in Visual Studio.

noteNote
The workflows that are created or modified outside of Microsoft Dynamics CRM cannot be viewed or modified in the Microsoft Dynamics CRM process designer. You can only change the status (Activate or Deactivate) of these workflows. These workflows will run in Microsoft Dynamics CRM as per the workflow definition.

Prerequisites for Working with Custom XAML Workflows

You must use Microsoft Visual Studio 2010 to develop custom XAML workflows for Microsoft Dynamics CRM.

To work with the XAML workflows that are created or modified outside of Microsoft Dynamics CRM, make sure that:

  • Your user account has the Deployment Administrator privilege in Microsoft Dynamics CRM.

  • Declarative workflows are enabled on the Microsoft Dynamics CRM server. By default they are not enabled. To enable them, use the following procedure.

Enable or Disable XAML Workflows

You can use Windows PowerShell to enable or disable XAML workflows, as described here. Alternatively, you can use the Deployment Web service. For more information, see Deployment Entities and Deployment Configuration Settings to learn how to programmatically update the AllowDeclarativeWorkflows property.

To enable XAML workflows

  1. Open a Windows PowerShell command window.

  2. Add the Microsoft Dynamics CRM PowerShell snap-in:

    Add-PSSnapin Microsoft.Crm.PowerShell
    
  3. Retrieve the current setting:

    $setting = get-crmsetting customcodesettings
    
  4. Modify the current setting:

    $setting.AllowDeclarativeWorkflows="True"
    
    set-crmsetting $setting
    
  5. Verify the setting:

    get-crmsetting customcodesettings
    

To disable XAML workflows

  1. Open a Windows PowerShell command window.

  2. Add the Microsoft Dynamics CRM PowerShell snap-in:

    Add-PSSnapin Microsoft.Crm.PowerShell
    
  3. Retrieve the current setting:

    $setting = get-crmsetting customcodesettings
    
  4. Modify the current setting:

    $setting.AllowDeclarativeWorkflows=0
    
    set-crmsetting $setting
    
  5. Verify the setting:

    get-crmsetting customcodesettings
    

Using the Visual Studio Workflow Designer

Using the Visual Studio Workflow Designer, you can do the following:

  • Visually create workflows without having to write code. You can create a workflow project in Visual Studio by using the built-in Visual Studio Activity Library template, and then use a Workflow activity as the root activity. For information about how to create a workflow project, see Walkthrough: Create a New Workflow in Visual Studio.

  • Add the Microsoft Dynamics CRM workflow activities in the toolbox. For more information, see Add Microsoft Dynamics CRM Workflow Activities to the Toolbox.

  • After a workflow project is created, you can add activities to the root activity. For more information, see Add an Activity to a XAML Workflow Project.

  • Move activities in a workflow. Some activities, for example, the Sequence activity, can contain multiple child activities. You can create variables to hold values and references that are important to your workflow by using the variables designer. For further information see Create Variables in a XAML Workflow Project.

  • Modify pre-existing workflows. In this case, workflows must first be exported from Microsoft Dynamics CRM, and can be modified in Visual Studio before being imported back into Microsoft Dynamics CRM. For a walkthrough that explains how to do this, see Walkthrough: Modify an Existing Workflow in Visual Studio.

See Also

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.