What is Context?

Context is a JSON structure which is updated at each step in your sequence and is enriched by workflows or UI Jobs. During execution, the Context holds the state of your sequence and is used to transfer variables and information between stages in your sequence. Once completed, Context is saved with your sequence and you may consider it as the history of your sequence execution.

Forms and context

Forms objects will automatically try to read values from Context and will write values back when form is saved.

Global variables and Global context

The Global Context contains global variables and is copied from task to task, and between workflows and forms. 


Globals can be accessed using this syntax:

gc[“my_var”] = my_value


gc.my_var = my_value


Local variables

Local vars are defined in a workflow task. As a part the Context, local variables will be copied from task to task. 


However, local variables are not passed to another workflow or form. Only values defined in the Global Context (i.e global variables) will be copied.


Locals can be addressed using this syntax:

my_local_var = value



Tracking context values

In order to track context values, go to the admin sequence menu item and select your sequence instance.



Click on the  icon to display the current context values at the end of each step. This shows only the global context values.



Tracking local context values

To display context variables local to a workflow execution, select a workflow and expand the Flat tasks item. Select the desired task and you will see input and output context items. Expand one of them to see the context values.



Accessing Global Context from JS Callbacks

Forms provides Javascript callbacks for each object. You may want to access some of the variables in your context from the Javascript side. 


You can the following syntax to access the Context from within a Javascript callback.






Specific form object context values format

Each object in a form read and save data in a specific format. A string field will save a simple string. However, more complex objects save more complex data structures, such as the media_selector context value, for example:


media_selector context value

    "media_selector": {
        "files": [
                "file_profile": "N/A",
                "file_format": "QuickTime / MOV",
                "file_duration": "0:03:28",
                "file_name": "reggae.mov",
                "file_frame_rate": 23.976023976023978,
                "uri": "file:///mnt/sharing1/media_sources/reggae.mov",
                "file_bytes": "75119658",
                "is_video_file": true,
                "last_modification": 1581110851.0702932,
                "file_size": "75.1 MB",
                "position": 7,
                "file_seconds": "208.361667",
                "mapped_path": "\\PULSE-IT-AD\sharing-ad\\media_sources\\reggae.mov"
        "__media_tag__": "root_media_selector",
        "connector_data": {
            "connector_key": "media_sources",
            "mode": "online",
            "co_directory": "/mnt/sharing1/media_sources/"
        "file_url": "/automateit/directory/get_file?connector_key=...",
        "thumbnail": "/automateit/directory/get_file_thumb?connector_key=...",
        "connector": "Directory_Connector",
        "connector_type": "directory",
        "tag": "root_media_selector",
        "id": "select_media",
        "order": 0,
        "file_path": "/mnt/sharing1/media_sources//reggae.mov"


Uploader context value

"uploader": [
            "mounted_path": "\\\\PULSE-IT-AD\\sharing-ad\\media_sources\\",
            "name": "DSC_7599.jpg",
            "stored_name": "9bdf6d64-75c9-446c-b75e-0a464e538ef4.jpg",
            "uuid": "9bdf6d64-75c9-446c-b75e-0a464e538ef4",
            "__id__": "c3480b4d-7a45-4f2b-a780-1770e8bf4ea3",
            "thumbnailUrl": "/automateit/directory/get_file?connector_key=…",
            "size": "2110502"





Context values step by step

The diagram below shows a simple testing sequence.

It will execute 2 chained workflows, then display a form and then link to another workflow. We will add values in our context and see how those values are going to be managed.


Workflow 1

Our workflows will set the “Agent context parameters” values to be “starting workflow 1”, “starting workflow 2”, …


And here is the detailed view of workflow 1. 



Let’s examine each task.


Start Task

There is no configuration on this task.


Task message

We have defined a callback when the task initializes which sets 2 variables

       callback_var = "on init"
       gc["callback_global"] = "on init"


Eval code task

This task defines 1 global and 1 local variable.

 myvar = "local"
 gc["global"] = "global"


Task message

There is no configuration on this task.


By looking into the context debugger we can see:



Starting a sequence will automatically define some global variables

  • deadline
  • title


Some variables are defined as Globals

  • workflow context
  • global
  • callback_global


Some Variables are defined as Locals

  • mywar
  • callback_var


Workflow 2

Our 2nd Workflow sets the Agent Context parameter “workflow context” to “Starting workflow 2”


Let’s check our variables in context



  • Locals has been removed from context
  • Globals has been copied from Workflow 1 to Workflow 2




We are now going to use a UI Job and check what variables can be accessed.

Our Form fields

myvar                         string

global                         string

value                          string

callback_global           number


On top of that, we have defined a Notification workflow, that will be triggered on any event.





  • Automatic mapping of globals (global)
  • No mapping for locals (i.e myvar and value)
  • callback_global is not displayed because it has the wrong type. ‘on init’ value can’t be converted to number value.



Our Notifications workflow has specific context values.


The notifier structure



Workflow 3

Our 3rd Workflow sets the Agent Context parameter “workflow context” to “Starting workflow 3”




  • Undefined vars presented in forms will be created as globals
  • Form field myvar is now a global
  • callback_global remains unchanged because form type (number) is different from variable type (string)

Child contexts and loops

When using iterators or loops, you should remember that the context in the iterator and the context in the iterated part may be different.


Therefore, the while loop condition should be a global variable, otherwise this condition will not be changed by other tasks in the workflow.




It is the same issue if your code is looping. 



Let’s say we have this simple loop workflow which increments count by one until count is greater than 5.



        count = 0

If or Not: 

        if count > 5


        count = count + 1


This will not work because ‘count = count + 1” is changing the value of count in the copy of the context used by “if or Not”. 


count will be incremented to 1 by EvalCode2 and then be equal to 0 when looping to “If or Not” and restoring its context.


Job settings

For each job, you can change the way context are exported. 


By default, context will be duplicated when passed to the next task. This is the easiest method.



The second choice is to select ‘Through task key’. In this case, context will be available from other tasks using the task_key prefix.



Incrementing count from the eval code tasks is done by prefixing count by the while task key.


Accessing System variables

Workflows and sequence variables can be accessed from any evaluated expression using the 'workflow' object (ex: workflow.workflow_name).


Variable name



current workflow instance id


workflow template id for current instance


workflow template name for current instance


Sequence id for current instance (if executed from a sequence)


Sequence name for current instance (if executed from a sequence)


Job id for current instance (if executed from a sequence)


Node name executing the current workflow


Node id executing the current workflow