Flow Steps (Simple)
  • Updated on 11 Mar 2019
  • 1 minute to read
  • Print
  • Dark
    Light

Flow Steps (Simple)

  • Print
  • Dark
    Light

Summary

You can easily create new steps to be used in Decisions by creating public static methods in a class file project. This article will show you how to accomplish this.

Note
Custom codes are located here: C:\Program Files\Decisions\Decisions Services Manager\Instances\Control\CustomReferences

Example

In this example Visual Studio 2017 is being used. Create a new  Class Library project in Visual Studio. To add the Decisions SDK, in the  Project Solution window, right click your project and go to  Manage NuGet Packages. Under the browse tab search for  DecisionsSDK

DownloadDecisionsSDK.png

Decorate your class with the following attribute: [AutoRegisterMethodsOnClass(true, "Sample Category", "Example Steps from Class File", RegisterForAgents = true)]

Create a public static method in your class that will represent what process will take place. This method will become a step in Decisions. The name of your method will be the name of your step. Also the inputs and outputs of your method will become the inputs and outputs of your step. See the following code for two example methods that we will use to create steps inside of Decisions.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DecisionsFramework.Design.Flow;

namespace ClassLibrary_BuildingFlowStepsExample
{
     [AutoRegisterMethodsOnClass(true, "Sample Category", "Example Steps from Class File", RegisterForAgents = true)]
     public class MyClass
     {
         public static Int32 AddTwoNumbers(Int32 number1, Int32 number2)
         {
             return number1 + number2;
         }
         public static bool IsStringLengthEqualTo(string stringToEvaluate, Int32 length)
         {
             if (stringToEvaluate.Length == length)
             {
             return true;
             }
             else return false;
         }
     }
 }

After you have written your methods build your project. To add your project to Decisions, follow the steps here: Deploying server side extensions

After using the above steps to deploy your code, log into the Decisions portal and create a new flow. You will now see the methods from your class in the Steps Toolbox .

CreatedSteps.png

Add the Add Two Numbers step into the flow. Connect the start and end steps and add input data to your start step.

InputDateStartStep.png

Once the Start Step input data is mapped to the Add Two Numbers step, click the Debug Flow button.

DebugFlow9.png

Provide the debugger with input data and click the Run button.

RunDebugger.png

On the output of the Add Two Numbers step you will see that the two numbers provided as inputs are added together.

StepOutput1.png

Was this article helpful?