Passing Parameter Value

◷ Reading Time: 3 minutes

In a hierarchical logic document such as a Flow, the (parent) may contain some other logic, such as a Decision Table (child). To pass some values from parent to child logic, we need to add a Parameter with the same name in both logic documents (parent and child), and also set the context for the child to be shared.

For example, in the example below, we have a Flow (as a parent) in order to find the kid’s category based on their age. Our Flow contains a Decision Table (a child) to carry out rules.

Shared Context

Shared Context is used when the relationship between parent and child logic is simple (i.e., There is no conversion is required to pass the value of Parent Parameter to Child Parameter).

In this Flow, we have an Input Parameter (which is Age) and an Output Parameter (which is Category). Now if we define both these Parameters in our Decision Table, then their context would be shared. This is because the added Parameters have the same NAME as shown below:

We have created two Parameters (Age and Category) in the Flow, and for purposing the shared context, we have created two Parameters (Age and Category) in our Decision Table.

New Context

New Context is used when the relationship between parent and child logic is not simple. This means passing the parameter’s value from parent to child requires conversion (e.g., sending an object (JSON) into the Flow which has some attributes that the Decision Table requires). In these cases, we need to set a mapping between the parent’s parameter to the child’s parameters. In the Flow, this is done by selecting the Decision Table (or other child logic) and:

  1. Setting the execution context to New
  2. Adding the map using the Parameters properties

For example, when we pass a complex structure (e.g., JSON) that has some attributes (e.g., Age) the settings below need to be applied:

  • Add an input Parameter in our Flow and call it a “record” (the record has the Age as an attribute and we need to pass it to our Decision Table).
  • Add an input Parameter for our Decision Table and call it “Age”.
  • Change the Decision Table’s Context Mode to New.
  • Add a Parameter for our Decision Table inside the Flow (select the Decision Table in the Flow/click on Properties/Parameters):

The Name is “Age” and its Value is: “record.Age”(because it is using the record’s attribute which is “Age”):

  • Now the Flow can be fed by a simple JSON as below:
 {
  "Age": 12 
 }
Updated on April 8, 2022

Was this article helpful?

Related Articles