Flow Steps and Rule Steps (Simple): Creating Custom Data Types

Last Updated: 07/15/2016 Introduced in Verision: 2.0
You can easily create new datatypes to be used in Decisions by creating classes in a class file project. This article will show you how to accomplish this.
Create a new Class Library project is Visual Studio.
Add a reference to the .Net library  System.Runtime.Serialization
Add the following using statement to your project:  using System.Runtime.Serialization;
Create a public class for your data type and decorate this class with the following attribute: [DataContract] 
Add public properties for each property you want on your class decorated with the following attribute: [DataMember] 
After adding all the properties you want, add public parameterless constructor.
Below is an example of code that follows these patterns:





After you have written your classes, build your project, copy the compiled dll to  C:\Program Files\Decisions\Decisions Services Manager\modules\Decisions.Local\ServicesDlls, and restart Service Host Manager service.

Types need to be registered in order to be used in the platform.  Types are automatically registered when they are used in a flow or rule step or as part of a hosted service definition.  If you want to register a type without using it, you should call the register native type method.




 Note: only types, not array versions of types, are to be registered.

After Service Host Manager has finished restarting, log into the Decisions portal. Now in any list of datatypes you will see the types you just added. As an example, you can create a new flow and use the Create or Copy Data step to view available types to select from. Below is a sample screen shot showing how this list would look after publishing the type shown in the example code above.

Additional Resources