Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon
No ratings
sai_sp
Saviynt Employee
Saviynt Employee

Use Case:

 How to send out emails with different body content to different recipients based on certain conditions using a single email template? OR  how to just limit sending the emails altogether to some recipients based on certain conditions?

 

This is particularly very useful in creating the task completion email template to send out access provisioned notifications to varying recipients.

 

Solution:

Email template support if else condition, refer below examples on how if-else conditions can be used to conditionally send email or conditionally change content of email body.

To:

<% if (task?.tasktype == 3) print "${manager?.email}" else if (task?.tasktype == 1) print "${manager?.email},${requestor?.email},${user.email}" %>

 

cc:

<% if (task?.tasktype == 3) print "${user.customproperty33},${requestor?.email}" else if (task?.tasktype == 1) print "${requestor?.email}" %>

 

Subject

<% if (task?.tasktype == 3) print "New Hire Notification:  ${user.firstname} ${user.lastname}." else if (task?.tasktype == 1) print "Access granted for ${user.firstname} ${user.lastname}." %>

 

Body:

<% if (task?.tasktype == 3)

 print "Dear ${manager.firstname} ${manager.lastname},</div><div>&nbsp;</div><div>A new user account has been created for ${user.firstname} ${user.lastname}.</div><div>&nbsp;</div><div><b>Username:</b> ${task.endpoint.customproperty1}${user.systemUserName}</div><div><b>Password:</b> ${task.password}</div><div><span><b>Container:</b>&nbsp;${user?.customproperty31}<br></span><b>Cost center:</b>&nbsp;${user?.costcenter}<br><b>Start date:</b>&nbsp;${user?.startdate}<br><br></div><div>Please ask ${user.firstname} to browse to <a href=\"http://test.sav.com/\">http://test.sav.com/</a> and reset this password for initial use.</div><div><br>This email is also being&nbsp;sent out to following recipients:<br><br>1. Manager:&nbsp;${manager?.email}<br>2. Distribution List:&nbsp;${user?.customproperty33}<br>&nbsp;<br><b>Feedback, questions and support:</b></div><div>Your feedback is always welcome. If you need assistance or have any questions, contact helpdesk to log your ticket. Someone on the team will contact you.</div><div>This is an automated message. Please do not reply to this email.</div><div><br></div><div>Thank you,</div><div><span>- SaviyntAdmins@sav.com<br></span><br></div><div><i>This email message is intended only for the addressee(s) and contains information that may be confidential and/or copyrighted. If you are not the intended recipient please notify the sender by reply email and immediately delete this email. Use, disclosure, or reproduction of this email by anyone other than the intended recipient(s) is strictly prohibited.</i></div>"

 else if (task?.tasktype == 1)

 print "Dear ${requestor.firstname} ${requestor.lastname},</div><div>&nbsp;</div><div>Access has been granted for below request:</div><div>&nbsp;</div><div><b>Request ID:</b> ${requestid}</div><div><b>Requested For:</b> ${user.firstname} ${user.lastname} [${user.username}]</div><div><b>Requested By:</b> ${requestor.firstname} ${requestor.lastname} [${requestor.username}]</div><div>&nbsp;</div><div><b>Access Granted:</b><i> ${entitlement}</i><br></span></div><div></div><div>&nbsp;</div><div><br>&nbsp;<br><b>Feedback, questions and support:</b></div><div>Your feedback is always welcome. If you need assistance or have any questions, contact helpdesk to log your ticket. Someone on the team will contact you.</div><div>This is an automated message. Please do not reply to this email.</div><div><br></div><div>Thank you,</div><div><span>- SaviyntAdmins@sav.com<br></span><br></div><div><i>This email message is intended only for the addressee(s) and contains information that may be confidential and/or copyrighted. If you are not the intended recipient please notify the sender by reply email and immediately delete this email. Use, disclosure, or reproduction of this email by anyone other than the intended recipient(s) is strictly prohibited.</i></div>"

%>

 

 

Email Template Binding Variables: You can view the list of supported binding email variables for the email template using the Help button

 

 

Version history
Last update:
‎09/06/2023 06:32 AM
Updated by:
Contributors