Custom Workflow Activities Sample

Microsoft Dynamics 365 (online & on-premises) supports the registration and execution of custom workflow activities in addition to the out-of-box activities provided by Windows Workflow Foundation. Windows Workflow Foundation includes an activity library that provides activities for control flow, sending and receiving messages, doing work in parallel, and more. However, to build applications that satisfy your business needs, you may need activities that perform tasks specific to that application. To make this possible, Windows Workflow Foundation supports the creation of custom workflow activities.

You can write custom workflow activities in Microsoft Visual C# or Microsoft Visual Basic .NET code by creating an assembly that contains one or more classes derived from the Windows Workflow FoundationCodeActivity class. This assembly is annotated with .NET attributes to provide the metadata that Microsoft Dynamics 365 uses at runtime to link your code to the workflow engine.

After you have created an assembly that contains one or more custom workflow activities, you register this assembly with Microsoft Dynamics 365. This process is similar to registering a plug-in. The custom workflow activity can then be incorporated into a workflow or dialog in the Process form in Microsoft Dynamics 365.

For more information, see Custom Workflow Activities(workflow assemblies)

Requirements

For more information about the requirements for running the sample code provided in this SDK, see Use the sample and helper code

Sample: Create a custom workflow activity

This sample shows how to write a custom workflow activity that can create an account and a task for the account. This sample uses early binding.

Sample: Create a custom workflow activity

Sample: Update next birthday using a custom workflow activity

The following sample workflow activity returns the next birthday. Use this in a workflow that sends a birthday greeting to a customer.

Sample: Update next birthday using a custom workflow activity

Sample: Calculate a credit score with a custom workflow activity

The following sample workflow activity calculates the credit score based on the Social Security Number (SSN) and name.

Sample: Calculate a credit score with a custom workflow activity

Sample: Post data in a URL

 

Sample: Calculate the shortest distance between two points based on their zipcodes

 

Sample: Check if the "Est. Close Date" is greater than 10 days

 

Sample: Create a task with a subject equal to the ID of the input entity

 

Sample: Assign the lead to the user with the fewest lead records assigned

 

Sample: Perform addition of two summands