How To Build & Configure A Custom Process Step

Last published at: June 27th, 2023

Building, Configuring and Executing a Process Step.

This sample will illustrate how to build a new process step, how to configure it using the Configuration Manager UI, use the step in a process definition and then have the step execute using a process instance.

It's better to lead by example, so here's a video showing how to build a custom process step.

If you want to use our code, here's the code from the above example:

using FlowWright.Engine;
 
namespace FW10CustomItems
{
    [StepData("""Add two numbers""FW10")]
    [StepInput("value1""Enter value 1"true)]
    [StepInput("value2""Enter value 2"true)]
    [StepInput("varToStore""Store result in variable"true)]
    [StepReturn("True""True value")]
    [StepReturn("False""False value")]
 
    public class FWAddTwoNumbers : IFWStep
    {
        public FWFigureReturn Execute(FWEngineContext oEngineContext)
        {
            FWFigureReturn oReturn = new FWFigureReturn("True", StepState.Complete);
 
            try
            {
                int value1 = oEngineContext.GetFigureProperty<int>("value1");
                int value2 = oEngineContext.GetFigureProperty<int>("value2");
 
                int result = value1 + value2;
 
                string varToStore = oEngineContext.GetFigureProperty("varToStore");
 
                oEngineContext.UpdateVariable(varToStore, result);
 
            }
            catch (Exception ex)
            {
                oEngineContext.WriteError("FWAddTwoNumbers", ex, FlowWright.Logging.PriorityLevel.Medium);
            }
 
            return oReturn;
        }
    }
}