Getting Started

Available Variables in Email Templates

Updated: March 18, 2024

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

In your email templates, you have access to different variables depending if you are in an automation chain or in a workflow notification context. This page references them.

Automation Chain "Notification > Document.Mail" Operation Context

Variables that can be used to set up an email in an automation chain.

  • ${Document} - The context document. This is the document on which some action was done and the send mail operation was triggered. See Use of MVEL in Automation chains (document wrapper) for details.
  • ${docUrl} - The document URL.
  • ${viewId} - The view of the document which will be displayed by the document URL.
  • ${subject} - The mail subject.
  • ${to} - The mail recipients.
  • ${from} - The mail sender.
  • ${CurrentDate} - The current date. See Use of MVEL in Automation chains (date wrapper) for details.
  • ${Fn}- A collection of useful functions. See Use of MVEL in Automation chains (fn object) for details.
  • ${Env} - A hashmap containing Nuxeo environment variables. Example: Env["org.nuxeo.ecm.product.name"].
  • ${CurrentUser} - The current user.

    ${CurrentUser} is not correctly working for now in FTL templates. However, if your email template is sent in the context of an automation chain or script, it is possible to use a workaround by defining its value in a context variable:

    1. Use the Context.SetVar operation in your chain with the following parameters:
      name: currentUserId
      value: @{CurrentUser.name}
    2. Then use it in your email template:
      User ${Context['currentUserId']} sent you this email.

Workflow Task Notification Context

Variables that can be used when a notification is set up from a workflow node's configuration.

  • ${recipients} - The email recipients. Provided as a usernames list. Example: ${recipients[0]}.
  • ${userUrl} - The URL to access the profile of the user running the task. Note that this might not be the current user. See the workflow engine FAQ for details.
  • ${docMainFileUrl} - The URL of the document's main file (assuming the document contains one).
  • ${docState} - The document's current lifecycle state.
  • ${documentLifeCycle} - The document's current lifecycle state.
  • ${docTitle} - The document title.
  • ${docUrl} - The permanent link to the document.
  • ${docId} - The document id.
  • ${taskInstance} - The task instance id.
  • ${workflowStartTime} - The workflow start time, sent as a java.util.GregorianCalendar object.
  • ${workflowInitiator} - The workflow initiator username.
  • ${WorkflowVariables} - Hashmap containing the workflow variables. Example: ${WorkflowVariables['myVariableName']}.
  • ${NodeVariables} - Hashmap containing the node variables. Example: ${NodeVariables['myVariableName']}.
  • ${workflowDocuments} - Hashmap containing the workflow documents. Example: ${workflowDocuments[0].dublincore.title}.
  • ${nodeId} - The node id.
  • ${button} - The button id that was clicked for processing the task, if the current node is a task node.
  • ${nodeState} - The node's state.
  • ${state} - The workflow's state.
  • ${nodeStartTime} - The time when the node was started, useful for example when computing a due date (Due date expression: nodeStartTime.days(8)). Sent as a java.util.GregorianCalendar object.
  • ${nodeEndTime} - The time when the node was ended. Sent as a java.util.GregorianCalendar object.
  • ${nodeLastActor} - The last actor on the node. Useful for instance to know who closed a task when the task was assigned to a group.