Click HERE to see how Saviynt Intelligence is transforming the industry. |
05/12/2024 10:07 PM - last edited on 05/13/2024 05:45 AM by Sunil
Hello,
I'm encountering an issue with a business-related use case. Here's the scenario: "If the beneficiary's Custom Property 10 is set to 'Salary', an email should be sent to payroll@xyz.com notifying them that access has been added for this user."
I attempted to implement this using a condition in the "TO" field of the email template, but unfortunately, it didn't work as expected. Here's what I tried:
<% if ($user?.customproperty10 == "Salary") print "payroll@xyz.com" else if ($user?.customproperty10 == "Hourly") print "nikita@xyz.com" %>
<% if (${task?.userkey.customproperty10 == "Salary") print "payroll@xyz.com" else if (${task?.userkey.customproperty10 == "Hourly") print "nikita@xyz.com" %>
I also have a couple of questions:
Will the condition written in the email template be readable at the endpoint level? Like, if we attach the conditional based email template at the endpoint level and it triggers after the completion of an "add account/access" task, will the email template detect users with Custom Property 10 set to "Salary" based on condition and send emails only to them based on this trigger?
Looking forward to your response.
Thank you!
Nikita Pawar
[This post has been edited by a Moderator. We discourage the @ mention of other forum users or employees unless they have already involved themselves on the forum post.]
Solved! Go to Solution.
05/12/2024 10:11 PM
Email variables change based on where email template is attached.
To get what variables are present to use in the email template, check using the below expression. By putting it in the email body, it will print all variable names with values, and then accordingly, you can use it:
${this.binding.variables.each {k,v -> println "$k = $v" + "" + "br" + ">"}}
Please confirm where email template is attached
05/12/2024 10:58 PM
@NikitaPawar_ try below
<% if (null!=user.customproperty10 && user.customproperty10 == "Salary") print "payroll@xyz.com" else if (null!=user.customproperty10 && user.customproperty10 == "Hourly") print "nikita@xyz.com" %>
05/12/2024 11:12 PM
@NikitaPawar_ refer this post :
How to send different emails with if else conditio... - Saviynt Forums - 51043
Syntax for email template body - Saviynt Forums - 56535