Click HERE to see how Saviynt Intelligence is transforming the industry. |
04/12/2022 01:16 PM
In the email templates, to address i need to write conditional logic like If manager?.email!=null print "xyz@abc.com" else print "cde@abc.com" . I tried below example but not working
<% if ((manager.email != null)) print "${manager.email}" else print "axy@abc.com" %>
<% if ((manager?.email != null)) print "${manager?.email}" else print "xyz@abc.com" %>
any suggestions?
Solved! Go to Solution.
04/12/2022 02:48 PM
Hi,
See if this helps.
<% if (requesttype == 'Add') print "Add Role" else if (requesttype == 'Remove') print "Remove Role" else if (requesttype == 'New Account') print "New Account" else if (requesttype == 'Remove Account') print "Remove Account" else if (requesttype == 'Modify Account') print "Modify Account" %>
Thanks,
Pallavi Chaudhari
Persistent Systems Ltd.
04/12/2022 02:48 PM
i am trying to use this in email template,
can you help me how to use this here?
04/12/2022 02:48 PM
Hi,
Here's another example below.
<% if (null!=user.email && user.email!='') print"${user.email}" else print"${user.secondaryEmail}" %>
You can find more examples/samples in the documentation : https://saviynt.freshdesk.com/a/solutions/articles/43000622153
Note: I would suggest you to mask the customer information when posting screenshots.
Regards,
Avinash Chhetri
04/12/2022 02:48 PM
Hello, i also tried to use conditionals but it seems that it errors out and doesnt send out the email for me
All i want to do is a If statement. This is the exact statement that i used with the <% and the %> in the template. It doesnt seem to compile properly and the email never gets sent.
<% if ${task?.tasktype} ==3) print "Hello" %>
04/12/2022 02:48 PM
Patrick,
For your use case, try the following logic in your "To" list (just update the email address) :
${if(tasktype.equalsIgnoreCase('NewAccount')){'abc@xyz.com'} else {'xyz@abc.com'}}
Regards,
Avinash Chhetri
04/12/2022 02:48 PM
I tried below condition in Body but it is not working could you help
<% if (user.employeeclass != null)
print "Dear ${user.firstname} ${user.lastname},</div><div> </div><div>A new user account has been created for employee ${user.firstname} ${user.lastname}</div><div> </div><div><b>
Username:</b> ${user.systemUserName}</div><div><br></i></div>"
else print "Dear ${user.firstname} ${user.lastname},</div><div> </div><div>Access has been granted for below request:</div><div> </div><div>A new user account has been created for contractor ${user.firstname}</div><div> </div><div><b>Username:</b> ${user.systemUserName}</div><div><br></i></div>"
%>
04/12/2022 02:48 PM
Sai,
What is the error that you get ?
Reviewing the error from the logs would be a good way to resolve these issues.
Regards,
Avinash Chhetri
04/12/2022 02:48 PM
Sai,
I've attached an if else sample.
Regards,
Avinash Chhetri