Share Variables Between Objects in a Workflow
In some workflows, the solution requires handing over a variable from one object to another. This article helps you understand the general concept of sharing variables in IWS.
How to share variable from one task to another?
Let's have a look at the following example with two translators: shared_var_test_1 and shared_var_test_2. We want to share a variable (called variableA) from one translator to another.
To do that, three steps have to be taken
Step 1: Declare the variable as "output variable" in the source shape
This is done simply by typing the variable name (or comma-separated list of names) in the OutParams property of the source shape:
Step 2. Instruct the target shape to receive this new variable as input.
Click on the second task and in the CustomCMParams property set the name of the variable in the first column.
It does not have to be same variableA. You can use another alias for the target shape.
In the second column you should use the following construct:
EXPR#:param_TASK_[name_of_task]_[original_name_of_shared_parameter]:
EXPR#:param_TASK_ is a required prefix. [name_of_task] is the name of the task where shared variable was created (shared_var_test_1 in our example). And variableA is the original name of the shared variable.
There are three default variables generated by each shape: :TASK_[name_of_task]_STATUS:, :TASK_[name_of_task]_CORRID: and :TASK_[name_of_task]_SEVERITYCODE: . Such variables do not require 'param_' prefix in front of them.
Final expression for our example:
EXPR#:param_TASK_shared_var_test_1_variableA:
Step 3. In the source shape, make the variable visible to the whole workflow.
This step differs depending on the type of source shape. Expand corresponding link below to see specific details
To verify that new variables are passed to the target shape, run your workflow and check the Control Message tab in the Monitoring Tool.
You should be able to see your new variables as input parameters in the RTR: