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

Multiple condition in email templates is not working

saimeghana
Regular Contributor II
Regular Contributor II

Hi Team,

We are using the if else condition in email template and we need to add some more condition for different type of users. We are using these email templates via Endpoints

Template: This is working condition.

<% if (user?.cp == 'abc') print "Hi , ${user.firstname} ${user.lastname} ........

(Employee ID : ${user.employeeid})......... "else if(user?.cp =='xyz') print " ${user.firstname} ${user.lastname} (matricule : ${user.employeeid})" %>

we need to add more condition and tried with below condition.

1) ${user.cp1=='abc' && user.cp!=null ? Employeeid: ${user.customproperty24}} not able to save the template throwing error.

saimeghana_0-1721050507411.png

2) ${user.cp=='abc' && user.cp!=null ? user.customproperty24: ${user.customproperty24}} working but we need to add the text/word where we highlighted instead of user.customproperty24 we need to add  employeeid.

Please help us to resolve the issue.

Thanks,

Sai Meghana

5 REPLIES 5

NM
Honored Contributor II
Honored Contributor II

@saimeghana try this

<% if (user.cp.equals('xyz') print "abc" else print "user.emoloyeeid" %>

rushikeshvartak
All-Star
All-Star

<%
if (user?.cp == 'abc' && user?.cp != null) {
print "Employee ID: ${user.employeeid}";
} else {
print "Custom Property: ${user.customproperty24}";
}
%>


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi Rushikesh,

Tried with this condition still we are not able to save the template.

<% if (user?.cp == 'abc') print "Hi , <br><br> From ${user.startdate.format('ddMMyyyy')}, ${user.firstname} ${user.lastname} team. <%if (user?.entity == 'WW SuccessFactors' && user?.customproperty3!= null){ print "SAP SF ID: ${user.customproperty24}"} else { print "Employee ID: ${user.employeeid}"}%> <br><br> Please find below the data.<br><br>Logon ID : ${user.cp}"else if(user?.cp =='123' ||user?.cp=='456') print "Hello , <br><br> Good morning,  ${user.firstname} ${user.lastname} (matricule : ${user.employeeid}) <br>Vous trouverez ci-dessous les codes <br><br>Identifiant de connexion : ${user.cp2} <br><br>Adresse email : ${user.email} <br><br>" %>

Error: 

saimeghana_0-1721058415425.png

Thanks,

Sai Meghana

[14:01] Rushikesh Vartak

(${user?.entity == 'XXSuccessFactors' && user?.customproperty3 != null ? 'XXXX ID: ' + user.customproperty24 : 'Employee ID: ' + user.employeeid})

 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Thank you, it solved the issue