Creating Notification Templates
Available Liferay 7.4 U60+/GA60+
With Notification Templates, you can design automated email and user notifications for Liferay services. Each template identifies a sender, recipients, and message content. While designing the template, you can search supported entities and add field references that insert their data dynamically into emails.
Currently, notification templates only support object actions. However, Commerce Channels include built-in notification template capabilities for channel events. See Store Emails for more information.
To use email notifications, your instance must have a configured mail server. Once configured, you can access additional email notification settings at the instance level.
Adding Email Notification Templates
Open the Global Menu (
), go to the Control Panel tab, and click Notification Templates.
Click Add (
) and select Email.
You can use object field references to populate messages dynamically with entry data. In the template designer, go to the Definition of Terms section and use the Entity drop-down menu to select an object definition. Copy and paste a field reference term into the desired template field. You can only reference fields for entries directly involved in the object’s action.
In Basic Info, enter a name and description for the template.
In Settings, enter contact information for the email sender and recipients.
To add multiple recipients, separate email addresses with a comma (e.g.,
[email protected],[email protected]
).In Content, enter a subject, select an editor type, and create the body of the email.
For type, select Rich Text or FreeMarker Template.
(Optional) Select object attachment fields to include their assets in email notifications.
importantYou can only attach assets from object entries involved in the notification action.
Click Save.
Once created, you can use notification templates with object actions. See Defining Object Actions for more information.
Adding User Notification Templates
Open the Global Menu (
), go to the Control Panel tab, and click Notification Templates.
Click Add (
) and select User Notification.
You can use object field references to populate messages dynamically with entry data. In the template designer, go to the Definition of Terms section and use the Entity drop-down menu to select an object definition. Copy and paste a field reference term into the desired template field. You can only reference fields for entries directly involved in the object’s action.
In Basic Info, enter a name and description for the template.
In Settings, determine the notification’s recipients.
You can use defined terms, user names, or user roles. To add multiple recipients, separate values with a comma (e.g.,
[%TICKET_CREATOR%]
,[%TICKET_R_ASSIGNEE_USERID%]
).In the Content section, enter the notification’s message.
You can use defined terms to populate values dynamically.
Click Save.
Once created, you can use notification templates with object actions. See Defining Object Actions for more information.