Tutorials

Available Variables in Email Templates

Updated: January 12, 2017 Page Information Edit on GitHub

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 > Send Email" 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.

6 months ago Solen Guitter NXDOC-907: user 'lifecycle' instead of 'life cycle
7 months ago Bertrand Chauvin Add workaround for missing currentUser variable
8 months ago manonlumeau fix related pages panel
8 months ago Andrew Goodricke Add content-review-lts2016 to labels
8 months ago Kevin Leturc NXP-19481: Update MarkLogic page to detail how to configure range element indexes
a year ago Manon Lumeau 19
a year ago Gildas Lefevre 18
2 years ago Solen Guitter 17 | Fix typo in workflowDocuments example
2 years ago Solen Guitter 16 | User doc reorganization: fix link to alerts
2 years ago Solen Guitter 15
2 years ago Solen Guitter 14
2 years ago Solen Guitter 12
2 years ago Solen Guitter 13
3 years ago Solen Guitter 11
4 years ago Solen Guitter 10
4 years ago Alain Escaffre 9
4 years ago Solen Guitter 8 | Format
4 years ago Bertrand Chauvin 7
4 years ago Bertrand Chauvin 5
4 years ago Bertrand Chauvin 6
4 years ago Bertrand Chauvin 4
4 years ago Bertrand Chauvin 2
4 years ago Bertrand Chauvin 3
4 years ago Bertrand Chauvin 1
History: Created by Bertrand Chauvin