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

How to send Span Style tag inside If else condition in email template

Sunny
New Contributor III
New Contributor III

Hi,

How can we pass Span Style font tag in If else condition of email template?

We have a Password Reset Email template, based on user's Customproperty1 we need to send the email template.

Actual Email Template Body:

<html>
<head>
<style>
.p1 {
font-family: "Times New Roman", Times, serif;
}
.p2 {
font-family: Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
Hi,<br>
<br>We are pleased to inform you that a password reset has been initiated for ${user.firstname} ${user.lastname} account in External Active Directory. <br>
<br>Password: <span class="p1"> ${task?.password}</span><br>
</body>
</html>
<br>If you encounter any issues or have any questions, please contact your usual  support team or contact your administrator.<br>
<br>Best Regards,
<br> IT Support Team<br>
</body>
</html>

 

If Else Confition:

<%if (user.customproperty1=='sv-SE')
print ""
else if (user.customproperty1=='pl-PL')
print ""
else if (user.customproperty1=='zh-CN')
print ""
else if (user.customproperty1=='nl-NL')
print ""
else if (user.customproperty1=='en-GB')
print ""
else if (user.customproperty1=='fr-FR')
print ""
else if (user.customproperty1=='de-DE')
print ""
else if (user.customproperty1=='it-IT')
print ""
else if (user.customproperty1=='ja-JP')
print ""
else if (user.customproperty1=='ko-KR')
print ""
else if (user.customproperty1=='pt-PT')
print ""
else if (user.customproperty1=='es-ES')
print ""
else if (user.customproperty1=='th-TH')
print ""
else if (user.customproperty1=='tr-TR')
print ""
else print ""
%>

Body: Same body has to go in every if else condition above(As we will change the template later based on language).

I have tried multiple apporaches to include the Styel Font in if else template however its throwing either error or the body was not resolving properly in the runtime.

 

1.Error Template Body Sample(Error: Operation not allowed as you are entering a value that resembles or contains script code):

<div>Hi,</div>
<div><br></div>
<div>We are pleased to inform you that a password reset has been initiated for ${user.firstname} ${user.lastname} account in External Active Directory.</div>
<div><br></div>
<div>Password: <span style="font-family: &quot;Times New Roman&quot;, Times, serif;">${task?.password}</span></div>
<div><br></div>
<div>If you encounter any issues or have any questions, please contact your usual support team or contact your administrator.</div>
<div><br></div>
<div>Best Regards,</div>
<div><br></div>
<div> IT Support Team</div>

2.Unable to resolve in Runtime Body, Email is triggering but no body content is showing:

<%if (user.customproperty1=='sv-SE') print "" else if (user.customproperty1=='pl-PL') print "" else if (user.customproperty1=='zh-CN') print "" else if (user.customproperty1=='nl-NL') print "" else if (user.customproperty1=='en-GB') print "<html> <head> <style> .p1 { font-family: "Times New Roman", Times, serif; } </style> </head> <body> <div>Hi,</div> <div><br></div> <div>We are pleased to inform you that a password reset has been initiated for ${user.firstname} ${user.lastname} account in External Active Directory.</div> <div><br></div> <div>Password: <span class="p1">${task?.password}</span></div> <div><br></div> <div>If you encounter any issues or have any questions, please contact your usual  support team or contact your administrator.</div> <div><br></div> <div>Best Regards,</div> <div><br></div> <div>IT Support Team</div> </body> </html>" else if (user.customproperty1=='fr-FR') print "" else if (user.customproperty1=='de-DE') print "" else if (user.customproperty1=='it-IT') print "" else if (user.customproperty1=='ja-JP') print "" else if (user.customproperty1=='ko-KR') print "" else if (user.customproperty1=='pt-PT') print "" else if (user.customproperty1=='es-ES') print "" else if (user.customproperty1=='th-TH') print "" else if (user.customproperty1=='tr-TR') print "" else print "<html> <head> <style> .p1 { font-family: "Times New Roman", Times, serif; } </style> </head> <body> <div>Hi,</div> <div><br></div> <div>We are pleased to inform you that a password reset has been initiated for ${user.firstname} ${user.lastname} account in External Active Directory.</div> <div><br></div> <div>Password: <span class="p1">${task?.password}</span></div> <div><br></div> <div>If you encounter any issues or have any questions, please contact your usual  support team or contact your administrator.</div> <div><br></div> <div>Best Regards,</div> <div><br></div> <div> IT Support Team</div> </body> </html>" %>

3 REPLIES 3

DixshantValecha
Saviynt Employee
Saviynt Employee

Hi,

We are checking on your request and we will keep you posted.

rushikeshvartak
All-Star
All-Star

<% if (user.customproperty1=='sv-SE') { %>
<% } else if (user.customproperty1=='pl-PL') { %>
<% } else if (user.customproperty1=='zh-CN') { %>
<% } else if (user.customproperty1=='nl-NL') { %>
<% } else if (user.customproperty1=='en-GB') { %>
<% } else if (user.customproperty1=='fr-FR') { %>
<% } else if (user.customproperty1=='de-DE') { %>
<% } else if (user.customproperty1=='it-IT') { %>
<% } else if (user.customproperty1=='ja-JP') { %>
<% } else if (user.customproperty1=='ko-KR') { %>
<% } else if (user.customproperty1=='pt-PT') { %>
<% } else if (user.customproperty1=='es-ES') { %>
<% } else if (user.customproperty1=='th-TH') { %>
<% } else if (user.customproperty1=='tr-TR') { %>
<% } else { %>
<html>
<head>
<style>
.p1 {
font-family: "Times New Roman", Times, serif;
}
</style>
</head>
<body>
<div>Hi,</div>
<div><br></div>
<div>We are pleased to inform you that a password reset has been initiated for ${user.firstname} ${user.lastname} account in External Active Directory.</div>
<div><br></div>
<div>Password: <span class="p1">${task?.password}</span></div>
<div><br></div>
<div>If you encounter any issues or have any questions, please contact your usual support team or contact your administrator.</div>
<div><br></div>
<div>Best Regards,</div>
<div><br></div>
<div> IT Support Team</div>
</body>
</html>
<% } %>


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

Sunny
New Contributor III
New Contributor III

Hi @rushikeshvartak 

 

Thank you for your response. It worked.