Configuring Velocity Email Notifications

Configuring Velocity Email Notifications

Velocity Email Notifications

The workflow email notifications process has been changed as of Rhythmyx Patch 732_20180928 to use the Velocity Templating Engine.  At this point, there will no longer be a real 'Cc' list or 'Additional Recipient List.'  The 'to' list and the 'Cc' list are now combined and will all be sent individually to each recipient as a custom e-mail.  All recipients (including Cc's) will receive an individual e-mail customized to them. This way, logic can be used to customize each e-mail to the recipient using Velocity.  The list of recipients is generated from two areas of the product:

  1. Using the 'Additional Recipient List' and 'Cc List' within a state's transition notification entry (see image below).
  2. Using the list of users assigned to a role that is configured to receive e-mail notifications for a particular transition.  That user must be of type 'Assignee' and have notifications enabled (see image below).

Workflow Notifications Assignees

Velocity Notifications Assignees

Additional Recipient and Cc Lists:
 Velocity Notifications Transition Assignees


Examples

With that said, each e-mail is now being processed using Velocity as a Velocity template. The subject and body fields are valid to use with Velocity syntax.

Velocity Notifications Email


Available Bindings:

Every binding available in Job Notification templates should be available including:

All Content Item fields

${displayname}
${sys_title}
${sys_contentstartdate}

etc.

Note: content item bindings must begin wtih '${' and end with '}' as outlined below.

Other bindings (these are not wrapped with ${} as above):

$wfcomment - the workflow transition comment
$wflink - description below $userSubject - the PSSubject object for the recipient based on e-mail (or null if doesn't exist).
This can be used to obtain a user's attribute set via Rhythmyx Server Administator such as 'sys_email', for example.
$wfemail - the e-mail address of the recipient
$tools - Velocity tools

A new '$wflink' token has been added to the workflow template markup. The $wflink (if included) will place the content URL of the item being transitioned in the e-mail body. If a user does not include a reference to $wflink in the body the content URL will behave as before.  If it is inserted, it will appear as the user sets it. To remove it completely, a user could do something like:

#if(1 == 2)##
$wflink
#end##

This would tell the system that the user has chosen to do something with the wflink, however, it won't be inserted into the template as 1 will never equal 2.

A PSSubject object is returned for every valid email address (Cc or To) that is present within the system and cataloged under a Role (more details below).  The PSSubject object can be useful for retrieving various information related to a subject.  This object returns properties and attributes set for a user in the RhythmyxServerAdministrator such as 'sys_email' and 'loginDisabled.'  It can also return what type of security provider belongs to the subject, the name of the current subject, etc.  Users with the 'loginDisabled' attribute set can retrieve the value of this property if that user has a valid PSSubject object. If the user has no corresponding Roles table the PSSubject will return null. The binding can be retrieved via:

#set($subject = ${userSubject})##

and processed like:

$subject.getAttributes().getAttribute("loginDisabled").getValues().get(0)

or

$subject.getAttributes().getAttribute("loginDisabled").getValues().get(0) == "false"

Details on How a PSSubject is Returned For Every User

If the user has an entry in the Server Administrator, under Security --> Roles, then they should belong to a role. If that role is enabled for notifications, then the system should pick up those entries as nonAdHocUsers and adHocUsers.

At this point, it filters out by community and folder security.  At this point the system will have a user login and be able to return a PSSubject object which will include all attributes (sys_email, loginDisabled, etc.) set on that object.

The Cc and Additional Recipient list can contain a list of comma-seperated e-mails. If an e-mail was provided in this list it would either match what is in the nonAddHocUsers and addHocUsers list, or be non-existent in the Roles table (an outside user with no affiliation to a role). At this point no PSSubject could be obtained for this address and would return null.

In short, any user with the 'sys_email' attribute set and has a role will return a PSSubject object.

If the e-mail corresponds to a user/role with the 'sys_email' attribute set, the PSSubject will be attached to the $subject binding. If it is not present, the $subject binding is null.