Workflow

Variables Available in the Automation Context

Updated: July 17, 2023

For a broader look about variables available in different contexts, have a look at the Understand Expression and Scripting Languages Used in Nuxeo page.

You need to be familiar with the concept of Automation for this section.

In the chains run on nodes (Input chain, output chain, transition and escalation chains) you have access to some data linked to the workflow being run.

  • WorkflowVariables: A hashmap, used like this: WorkflowVariables['my_workflow_level_variable']
  • NodeVariables: A hashmap, used like this: NodeVariables['my_Node_level_variable']
  • workflowInitiator: The user who launched the workflow.
  • workflowStartTime: The time when the workflow was started, useful for example when computing a due date (Eg: MVEL Due date expression: workflowStartTime.days(8)).
  • documents: The documents bound to the workflow. These documents are also set as input of all executed chains.
  • button: The button id that was clicked for processing the task, if the current node is a task node.
  • nodeId
  • state: The node state. A node waiting for its originating tasks to be completed is suspended. At the end of the workflow the node is done.
  • nodeStartTime: The time when the node was started, useful for example when computing a due date (Eg: MVEL Due date expression: nodeStartTime.days(8))
  • nodeEndTime: The time when the node was ended.
  • nodeLastActor: The last actor on the node. Useful for instance to know who closed a task when the task was assigned to a group.
  • CurrentUser.originatingUser: All the automation operations executed by the workflow engine are executed using a temporary unrestricted session (if the current user is not an administrator, this is a session with the user "system"). This variable allows you to fetch the current user.
  • ChainParameters: A hashmap, used like this: ChainParameters['my_chain_parameter']. Since 5.7.2, all chains are able to contain parameters as operation to be used from the automation context along their execution.
  • workflowInstanceId: The id of the workflow instance.
  • NodeVariables["tasks"]: Holds information about all tasks created by a node. Is a list of objects of type TaskInfo. You can iterate on this list and fetch for every task: the life cycle state (ended or not), the user who ended the task, the comment if any, and the id of the button the user clicked to complete the task (status).

You can use these variables on the node configuration form Studio: in automation chains, in the fields "Due Date expression" , "Compute additional assignees" and when setting up conditions on transitions or escalation rules .