Workflow .NET Assemblies

banner art

This section describes how to use Workflow .NET Assemblies to enable interaction between workflow rules and external systems.

In This Topic

Workflow .NET Assembly Setup

Describes how to set up a workflow .NET assembly.

Workflow Configuration File

Describes the configuration file needed for workflow .NET assemblies.

Workflow Configuration File Schema

Shows the schema for the configuration file.

Sample Files  

Shows sample code and the corresponding configuration file.

Overview of Workflow .NET Assemblies

Figure 1 – Overview of Workflow .NET Assemblies

You can call a Web service or any .NET assembly from workflow. This brings a great deal of extensibility to your workflow solution. Web services calls are treated as a special kind of .NET assembly calls. To call a Web service, you first provide a proxy assembly. Then you can reference this assembly in the workflow rule editor. Any assembly can be used, there is no need to sub-class or implement a particular interface in your assembly.

Support for Web Services

Web Services can be called from .NET assemblies. To do this you follow these steps:

  1. Create a proxy server or reference to the CrmService Web service. See Setting up the Web Services.
  2. Generate a library that references or contains the Web service classes.
  3. Move the assembly generated to this directory: <<installation drive>>\Program Files\Microsoft CRM\Server\bin\assembly\.
  4. Stop the Workflow Service.
  5. Update the configuration file: <<installation drive>>\Program Files\Microsoft CRM\Server\bin\assembly\Workflow.config
  6. Reset Internet Information Services (IIS): Click Start, Run, type iisreset and press Enter.
  7. Restart the Workflow Service.

Note   To interact with non-Microsoft Web Services use the Web Services Description Language Tool (Wsdl.exe) to generate a C# client proxy class.


Typically you want your assembly code to run under the context of the user who triggered the workflow. The following code demonstrates how to do this. Alternatively, you can pass the caller information as a parameter to the method. For more information on this technique, see Using the Caller Parameter Type.


The following code can be used in your workflow assembly code to impersonate the logged on user.

CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Get the current user ID.
WhoAmIRequest userRequest = new WhoAmIRequest();
WhoAmIResponse userResp = (WhoAmIResponse) service.Execute(userRequest);

service.CallerIdValue.CallerGuid = userResp.UserId;

For more information, see Security and Impersonation.

Support for Unsigned Assemblies

By default, the workflow service will only load signed assemblies. To load an unsigned assembly, you need to set the attribute allowunsignedassemblies to "true" in the configuration file as shown in the example below.


<workflow.config xmlns="" allowunsignedassemblies="true">

© 2007 Microsoft Corporation. All rights reserved.