Flow Steps and Rule Steps (Advanced) : Consuming Data

Last Updated: 12/05/2015 Introduced in Verision: 2.0
When writing an advanced step, your class must inherit from IDataConsumer if you want your step to have input data that you can map in at run time. The below line of code illustrates a class that inherits from  IDataConsumer.
public class SampleFlowStepInputs : BaseFlowAwareStep, ISyncStep, IDataConsumer

After inheriting from  IDataConsumer, you need to implement this interface. The implementation of this interface returns a array of  DataDescription[]. The below sample code illustrates two inputs: (1) a single text input, and (2) and array text input. Note: The names of these inputs are set to const string variable which were defined earlier in the code. This is not necessary, but is a best practice, since you’ll need to use this value to refer to the input data in the run method of your step.

The input value of your flow step will be consumed in the run method. The input data values will be contain in a dictionary in the run method. This dictionary is data.Data. Use the name of the input data as the key to refer to it in the dictionary as shown below. In this example we populate the variables  valueOfTextInput  and  valueOfTextArrayInput[] with the respective input data.


Consuming data for a rule step is much the same as a flow step with one exception. The anchor data of the rule step is automatically available inside the run method of the rule step and so doesn’t need to be handed in separately. This anchor data is available in the data.Data dictionary with the key of  this.AnchorData.Name.
The code below shows an example of a rule’s run method that compares the anchor data to an additional input that was added to the rule.


To see fully working example code from these two examples. Download the attached zip file which contains a project you can compile and use.

Additional Resources