Thursday 4 May 2023

Alerts Example - Send Consolidated Email to Manager

Create a resource alert from Tools - Alerts Composer

Resource - workers

 


Add Filter

Resource - workers

Expression -

exists ( Select 'x' from per_all_people_f p where p.person_id =${PersonId} and p.person_number in ('1001','1002','1003'))


Click Apply


Add Template


Click on Manage Recipients and Messages

Give the below in Communication Method as Mail, Expression as ${AlertUtils.toString(AlertUtils.empManagerList(workers.PersonId).WorkEmail)}

Group by - ${AlertUtils.toString(AlertUtils.empManagerList(workers.PersonId).WorkEmail)}

Add below text as message Text

This is a test email. The email is being sent to managers of below person numbers.

${AlertUtils.write("<table border=\"1\"> <tbody><tr><th>Person Number</th> <th>Person Name</th>")}
${AlertUtils.loop('workers','<tr><td>${workers.PersonNumber}<br></td><td>${workers.names.DisplayName}</td></tr>')}
${AlertUtils.write("</tbody></table>")}

Click Apply

Click Save and Close


Now run and test the alert.



No comments:

Post a Comment