---
title: "Create Custom Data Types with SDK"
slug: "flow-steps-rule-steps-simple-creating-custom-data-types"
description: "This document shows how to create custom data types for use in Decisions by creating classes within a class file project. The document discusses the procedure for adding a Class to Visual Studio, how to serialize the data by adding a reference, and finally, a couple of methods that users can implement to make the data show up in Decisions."
updated: 2024-12-09T20:51:54Z
published: 2024-12-09T20:51:54Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Custom Data Types with SDK

## Overview

Developers can use the Decisions Software Development Kit (SDK) to create new data types that are usable in a Decisions environment. This is done by creating classes for the type in a class file project, which is covered in the example below.

Decisions has a [Public GitHub](https://github.com/decisions-com/sdk-examples) repository that contains various SDK examples available for download.

Below is an attached data type that will be used in the example below that can be downloaded.

[Invoice.cs](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/Invoice.cs)

## Serializing Data

This example continues the simple code built in the [Flow Steps (Basic)](https://documentation.decisions.com/v9/docs/flow-steps-simple) article.

The code can optionally be retrieved from the referenced article but is not required to continue this example. 

1. In a .NET project, add a class and paste the code from the invoice.cs file.
2. To serialize data, add the reference **System.Runtime.Serialization**. Decisions respects all different serialization mechanisms.  
![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2020-03-09_130115.PNG)  
The Invoice data type has an InvoiceNumber, a Company, and an Address which are all simple types. It also has an array of LineItems. There is no code in this data type exclusive to the Decisions SDK other than the DataMember attributes, which are standard .NET serialization. This example code is simply a class with properties. Developers can use default parameters on properties within the code to enhance the experience for the user, for example, defaulting the ZipCode property to "23322".  
Now that the data type is built, there are two ways to get it to show up in Decisions:
  - Use the data type as an input or output on a step. Decisions will recognize that type should be exposed to the user.
  - When not using the data type on a step but the data type needs to be readily available, use the **[AutoRegisterNativeType]**attribute.  
  
If the custom code does not include any steps, it is necessary to use the [AutoRegisterNativeType] attribute to use the data type in Decisions.

### Using Data Type as an Input on a Step

1. In the ZipCodeManagement.cs project created in the [Flow Steps (Basic)](https://documentation.decisions.com/v9/docs/flow-steps-simple) article, add the code below. This method is a Flow step named "CalculateAmountForInvoice," with the input being Invoice (the data type created above) and the name of the input being newInvoice. This Flow step will return the number 15 if newInvoice and newInvoice.ForCompany is NOT null. If both properties are null then the Flow step will return 150.  
  
C#

```csharp
public decimal CalculateAmountForInvoice(Invoice newInvoice) {
            if (newInvoice != null && newInvoice.ForCompany != null) {
                return 15;
            }
            return 150;
        }
```

  
  
![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2020-03-09_131440.PNG)
2. Build the .dll and deploy it into Decisions.To learn more, see [SDK Basics](https://documentation.decisions.com/docs/project-sdk-extensions).
3. <licreate></licreate><strong="" a="" and="" designer="" edit="" flow="" in="" navigate="" open="" or="" panel="" steps="" the="" to="">Create or edit a Flow to open the Flow Designer, and in the <strong>Toolbox&nbsp;</strong>panel, navigate to <strong>SDK &gt; ZipCode</strong>. Drag and drop the <strong>Calculate Amount For Invoice</strong> step onto the workspace.&nbsp;<img src="https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2024-08-28_11h15_14.png" class="fr-fil fr-dib"></strong="">
4. With the step selected, choose **Build Data** as the mapping type for the **N****ew Invoice**. This shows all of the properties available within the data type that was referenced in the CaluclateAmountForInvoice****method. ![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2024-08-28_11h17_00.png)

### Debug

This step's purpose is to evaluate: If the new Invoice is not null and newInvoice.ForCompany is not null, and the output should be 15. Keep 'Build Array' as the mapping type for the new Invoice and choose 'Constant' and type "TestCompany" as the mapping type of For Company. Select **Debug**in the top action panel. While debugging, notice the output of the step is 15, as expected.

![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2024-08-28_11h20_32.png)
