Outputting Data Objects From Rule Steps
  • 28 Jul 2022
  • 2 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Outputting Data Objects From Rule Steps

  • Dark
    Light

Article summary

Overview

Rule Steps can be configured to return data objects, rather than just outputting true/false, using the following output options: 

Output OptionDescription
New Output DataDefines a new piece of data to output
Change ValueChanges the value of the input
Modify TextAdds text before (Prepend) or after (Append) input data
Run FlowRuns a Flow when a result or else is returned
It is possible to choose multiple output options.

Example

 The Rule in this example will determine if the age provided is less than or greater than 21. If it is under 21, it will output the message "You MUST be 21. Purchase is denied.". If the age is over 21, the message will display "Purchase is approved." Below is a downloadable example to import into Decisions.

To learn more on importing into Decisions, see Import and Export Overview.

  1. In a Designer Folder, select CREATE FLOW from the top action panel. Click Flow on the Create Flow window. Give the Flow a name (Output Data Object) and click CREATE.
  2. In the Flow Designer, select the Start step. On the Properties panel, click SHOW EDITOR under Flow Input Data below the FLOW INPUTS category.
  3. On the Flow Inputs dialog window, enter "Age" in the Name field. Click the dropdown list under the Type field and select Int32 [Number]. Save and then close the window to return to the Rule Designer.
  4. Click on the Done path. Select the Run Rule step and click ADD.
  5. Next, click PICK OR CREATE RULE on the Properties panel. On the Create or Pick Rule dialog window, select CREATE.
  6. Select Statement Rule. Enter a name for the Rule (Rule for Data Object) and click CREATE.
  7. Next, click SETUP INPUT DATA and DEFINE on the Rule Input Data dialog window.
  8. On the Input Data dialog window, enter "Age" under the Name field and change the Type to Int32 [Number]. Save and close to return to the Rule Designer.
  9. In the If statement block, create a Rule that will evaluate if the "Age" is greater than or equal to the value of 21.
  10. To output data objects, click Add under Return True in the Result block and then click New Output Data.
  11. In the AddOutput Data dialog window, enter "Purchase" under the Name field and click OK to return to the Rule Designer.
  12. In the textbox next to Purchase, enter "Purchase is approved." In the Else statement block, click the Purchase checkbox and enter "You MUST be 21. Purchase is denied." in the textbox. Save and close the Rule to return to the Flow Designer.
  13. Connect the Done outcome path to the End step and click Save.

Debug

  1. Click Debug on the top panel. 
  2. Enter a number in the textbox under Age less than 21 and click START DEBUGGING. Select the Run Rule step, click Execution 1, then select View Input/Output Data.
    The result will display the number entered, and the output will display the message typed in the Else statement block.
  3. Click CREATE NEW SESSION and enter a new value greater than 21. After the Debugger has run, view the Input/Output Data.
    The result will display the message that was typed in the Result block.



Was this article helpful?