Automation

Document Templates and Automation Rendering Service

Updated: July 17, 2023

Nuxeo Automation includes a service designed to perform renditions based on Freemarker or MVEL templating.

Two operations are provided for leveraging this rendition engine: Conversion > Render Document and Conversion > Render Document Feed

We list here the variables accessible in this rendition context and as a consequence in the templates.

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

For a more advanced rendition service, you may be interested in having a look at the Nuxeo Platform Template Rendering module.

FreeMarker Templating Language (ftl)

  • **${Document}** - the context document. This is the document on which the rendering is done in the case the rendering is done on a single document. When the input is a list of document then this variable is undefined.
  • ${This} - the rendering input. Will be a document in the case of a single document or a list of documents in th case of multiple documents.
  • ${Session} - the current core session.
  • **${Context}** - the context.
  • ${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. Note that **${CurrentUser}** is not correctly working for now in ftl templates - but only in mvel templates.

By using the FreeMarker templating engine, you also gain access to its whole functionalities. For example, using a document list could be done as following:

<#list This as doc>
  ${doc.title}
</#list>

Have a look at the FreeMarker manual for more information about it.

MVEL

  • **${Document}** - the context document. This is the document on which the rendering is done in the case the rendering is done on a single document. When the input is a list of document then this variable is undefined.${This} - the rendering input. Will be a document in the case of a single document or a list of documents in th case of multiple documents. ${Session} - the current core session. **${Context}** - the context. ${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.

By using MVEL, you also gain access to its whole functionalities. For example, using a document list could be done as following:

@foreach{doc : This}
  @{doc.title}
@end{}

Have a look at the MVEL manual for more information about it.