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

Email Template with if else condition

sabthamis
Regular Contributor
Regular Contributor

Hi Everyone,

We have a use case to send email content based on employee type. I have created a basic email with print statement  it worked. But When i am actually adding the original content it does not work. Below is the code which worked with basic text. When I am trying to add the original html content attached file for each condition the error comes as . I tried to save the below html code as sperate email template in that i don't receive any error (for employee i copied and pasted in separate email without any condition it worked) . I saved it as separate html file and able to view the content properly

Operation not allowed as you are entering a value that resembles or contains script code

<% if (task?.tasktype == 1 && user?.employeeclass=='Employee')

print "Dear user please find employee details"

else if (task?.tasktype == 1 && user?.employeeclass=='Contractor')

print "Dear user please find contractor details"

else if (task?.tasktype == 3)

print "Dear Access has been approved"

%>

Thanks

 

9 REPLIES 9

rushikeshvartak
All-Star
All-Star

Did you validated logs. Logs specifies error 


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

@rushikeshvartak  Yes i checked it. Even we got the email but in body nothing is showing only with subject we got the email.

sabthamis
Regular Contributor
Regular Contributor

@rushikeshvartak 

see below statements from log

sabthamis_0-1726060268702.png

 

Share code which is working in file 1 and other code in file 2 and merge code in file 3 as attachement


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

Here you go.

With the complete code now we are getting the email triggered. We have 2 issue noted in the email triggered.

1. we have are seeing the binding variable are it is. Values are not shown

2. For employee we get the content related to employee (one in if loop)  but for contractor we are getting the content for employee added with content for contractors.

Thanks

use attached file


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

@rushikeshvartak  I have used the code provided still no luck the same is happening.

Updated 


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

Vinu
New Contributor
New Contributor

I have same requirement, does it worked for you @sabthamis ?