Configure Email Templates

Create customized email templates and use them to send notification emails for human task and notify task activities. You can copy an existing email template and modify it as per requirements.

Create an Email Template for Human Tasks

You can create an email template by manually entering the HTML markup directly into the code editor provided in the Create an Email Template pane.

To create a new email template:

  1. Open a process in the process editor.

  2. Select a human task activity, and click Notifications Notification iconon the right side of the process editor.

  3. In the Notification pane, go to Manage Email Templates, and click Add email template.

    The Create an Email Template pane opens.

    Description of create-email-template.png follows
    Description of the illustration create-email-template.png

  4. Enter the HTML markup for your email template in the space provided for it.

    To include values from process variables and form arguments, you'll use mustache templates. Mustache templates provide a way to include predefined task variables, and values in an HTML markup. The following example shows how to reference the first name and last name with a data object using the mustache template:

    Template:

    {{#payload}}{{#DOName}}{{AttributeName}}{{/DOName}}{{/payload}}

    Object:

    <div class="container">
     <div class="label">Hello {{#payload}}{{#DOName}}{{firstName}}{{/DOName}}{{/payload}} {{#payload}}{{#DOName}}{{lastName}}{{/DOName}}{{/payload}}
     </div>
    </div>

    Note:

    To use values from process or task variables that are not predefined, associate the variables with a data object before referencing them as shown in the example.

     Output:

    Hello Joe Smith

    See Defining tags using mustache templates.

  5. Click Preview to view your template before finalizing it.


    Preview your template

    Note:

    In preview mode, the payload and action map sections don’t show the data.

Predefined variables of human task email notification

The following table provides a description of the predefined variables that you can use in a human task email notification template. Note that the variable names are case-sensitive.

You can refer the variables using the following format:

{{name_of_the_predefined_variable}}

For example:

{{title}}, {{assignee}}

Variable Description Syntax

assignee

Username of the task assignee.

{{assignee}}

actions

List of actions.

You can define the actions as shown in the following syntax:

{{# hasActions }}
    <div class="button-container">
        <div class="label">Actions</div>
        <div class="buttons">
            {{# actions }}
                <a class="action-button" href="{{workspaceURL}}">
                    <span title="{{actionDisplayName}}">{{actionDisplayName}}</span>
                </a>
            {{/ actions }}
        </div>
    </div>
{{/ hasActions }}

actionDisplayName

Display name of the action. For example, Approve, Reject.

You can define the action display name as shown in the following syntax:

{{# hasActions }}
    <div class="button-container">
        <div class="label">List of Task Actions</div>
        <div class="buttons">
            {{# actions }}
                <a class="action-button" href="{{workspaceURL}}">
                    <span title="{{actionDisplayName}}">{{actionDisplayName}}</span>
                </a>
            {{/ actions }}
        </div>
    </div>
{{/ hasActions }}

createdDate

Date of creation of the task

{{createdDate}}

creator

Stores the username of the creator.

{{creator}}

dueDate

Due date for completing the task

{{dueDate}}
expirationDate Expiry date of a task. {{expirationDate}}

hasActions

A Boolean value that indicates if an action is configured for a task.

{{hasActions}}

logo

Logo

{{logo}}

priority

Task priority

{{priority}}

payload

Map of task payload

{{payload}}

shortSummary

Task summary

{{shortSummary}}

taskId

Task ID

{{taskId}}

title

Title of the task

{{title}}

url

URL for accessing the task details in runtime.

{{url}}

updatedBy

Username of the user who updated the task.

{{updatedBy}}

updatedDate

Date the task was updated.

{{updatedDate}}

Predefined payload data and variables in human task notifications

Process Automation uses Mustache templates to display data. See Mustache and Mustache 5.

To define a… Example

Variable

Reference the predefined variables as shown in the following format:

{{title}}

To use multiple predefined variables, use comma as a separator. For example:

{{title}}, {{assignee}}

See the list of supported predefined variables.

Payload

To get the structure of the payload, see the incoming webform dataObject in the Data Association page of the human task activity. You can reference the following:

  • Process level data objects
  • Form argument data objects
  • User defined data objects
.

Payload Example 1: Format of a Form with form and business data objects

{{#payload}}{{#formDO}}{{inputText1}}{{/formDO}}{{/payload}}
{{#payload}}{{#myFormArgs1}}{{inputText2}}{{/myFormArgs1}}{{/payload}}
{{#payload}}{{#myFormArgs2}}{{inputText3}}{{/myFormArgs2}}{{/payload}}

Payload Example 2: Form with form and business data objects using HTML tags

<div class="info">
            <div class="container">
                <div class="label">Loan Application 1</div>
                <div class="value">{{#payload}}{{#appDataObject}}{{appName}}{{/appDataObject}}{{/payload}}</div>
            </div>
            <div class="container">
                <div class="label">Loan Application 2</div>
                <div class="value">{{#payload}}{{#myFormArgs}}{{appStatus}}{{/myFormArgs}}{{/payload}}</div>
            </div>
            <div class="container">
                <div class="label">secondLevel</div>
                <div class="value">{{#payload}}{{#accessSecondLevelValue}}{{#firstLevel}}{{secondLevel}}{{/firstLevel}}{{/accessSecondLevelValue}}{{/payload}}</div>
            </div>
            <div class="container col">
                <div class="created">
                    <div class="label">Created On</div>
                    <div class="value">{{createdDate}}</div>
                </div>
                <div>
                    <div class="label">Due Date</div>
                    <div class="value amber">{{dueDate}}</div>
                </div>
            </div>
            <div class="container link">
                <a class="view-link" href="{{url}}"> View in Browser</a>
                <div class="underline"></div>
            </div>
        </div>
Array loops

You can define arrays containing information in the form of elements. You can define the elements at different levels. For example the following screenshot shows how to define employee information at the second level.


Array loop for human task email notification

Sample code to define array at second level. In this sample code, the employee name, age and experience details are defined as elements at the second level.

{{#payload}}{{#secondLevelListDO}}{{#secondLevelList}}{{#employee}}
<li>Employee Name:{{empName}}<br>Employee experience: {{empExp}}<br>Employee age:{{empAge}}</li>
{{/employee}}{{/secondLevelList}}{{/secondLevelListDO}}{{/payload}}

Create an Email Template for Notify Tasks

If you have an email template, you can manually enter the HTML markup directly into the code editor provided in the Create an Email Template pane and modify the markup as per requirements.

To reference data objects in the email template, use the following code format:

${DOName.prop('AttributeName')}

For example:

${loanApplicationDataObject.prop('loanAmount')}

Note:

Email templates for notify tasks do not support:

  • Referencing process variables that are not part of a data object.

    Note:

    To use values from process or task variables that are not predefined, associate the variable values with a user defined data object before referencing.
  • Predefined variables
  • Array data in data objects