How to Pass Values Between Tasks

The Workflow engine allows values to pass between tasks. 

Tasks (PHP code) can use global variable `$context` to define any number of key/value pairs, which will be passed onto subsequent tasks.

Example 1

The following example shows how Task 1 would define an integer value and how Task 2 would use it.

Task 1

$context['int1'] = 123;

Task 2

$my_int = $context['int1'];


Example 2

The following example shows how Task 1 would define an "array" value and how Task 2 would use it.

Task

$context['array1'][0]= array('name', 'value');
$context['array2'][0]= array("string" => "string value", "integer" => 123);

Task 2

$array1 = $context['array1'][0];
$my_int = $context['array2'][0]["integer"];