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

If Else in Email Template

Isha
New Contributor III
New Contributor III

Hi,

We have a requirement of displaying entitlement details in email when entitlement is requested and role details when roles is requested and both if both are requested, for fetching the entitlement details we are fetching entitlementshtmltablerows and for roles we are using rolesshtmltablerows. 

How to use if condition so that it checks if entitlementshtmltablerows is not null only then the entitlement details are displayed and similarly if rolesshtmltablerows is not null only then role details table is displayed. 

I tried with the below query but when I click on save it gives a pop up saying 'Could not save as script is used'.

<if (entitlementshtmltablerows!=NULL) <table border=1 cellpadding=0 cellspacing=0 style=font-family: Poppins Light> <tr> <th>Application</th> <th> Groups </th> <th> Description </th> <th> Glossary </th> </tr> ${entitlementshtmltablerows}</table> %>

5 REPLIES 5

deepali198
New Contributor
New Contributor

Hi Isha,

I am able to save above script. You can try saving same in the new email template. Roles details you can fetch using 'rolesshtmltablerows'.

deepali198_0-1725872947643.png

 

 

Isha
New Contributor III
New Contributor III

Hi , I was able to add it in Email body as below:

<% if (entitlementshtmltablerows != NULL)
print "${requesttype}  Access for  ${user.username} <br> <table border=1 cellpadding=0 cellspacing=0 style=font-family: Poppins Light> <tr> <th>Application</th> <th> Groups </th> <th> Description </th> <th> Glossary </th> </tr> ${entitlementshtmltablerows}</table><br>"
 
 else if (rolesshtmltablerows != NULL)
print "<br> <table border=1 cellpadding=0 cellspacing=0 style=font-family: Poppins Light> <tr> <th>Application</th> <th> Application Roles </th> <th> Description </th> <th> Glossary </th> </tr> ${rolesshtmltablerows}</table><br>" %>
 
But NULL is not working. I am not able to see the body when using NULL.

NM
Honored Contributor II
Honored Contributor II

@Isha don't have to add null condition if entitlement doesn't exist it won't print.

indra_hema_95
Regular Contributor III
Regular Contributor III

Hi @Isha instead of NULL try '', for example rolesshtmltablerows = ''.

Regards,

Indra

rushikeshvartak
All-Star
All-Star

Use below code 

    <div> <%if(entitlementshtmltablerowsv3=='') { %> </div> <% } else { %>
           <p style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:0cm;line-height:normal;font-size:13px;font-family:"Verdana",sans-serif;'></p> <br>
            <table style="width:90%; margin-left: 20px; background-color: #E8E5E1;">
              <tr style="text-align: left;background-color: #E8E5E1;">
                <th style="background: rgb(255, 192, 0);vertical-align: top;">
                  <p style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:7.2pt;line-height:normal;font-size:13px;font-family:"Verdana",sans-serif;text-align:center;'><strong><span style='font-size:13px;font-family:"Verdana",sans-serif;color:black;'>Application</span></strong></p>
                </th>
                <th style="background: rgb(255, 192, 0);vertical-align: top;">
                  <p style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:7.2pt;line-height:normal;font-size:13px;font-family:"Verdana",sans-serif;text-align:center;'><strong><span style='font-size:13px;font-family:"Verdana",sans-serif;color:black;'>Entitlement</span></strong></p>
                </th>
                <th style="background: rgb(255, 192, 0);vertical-align: top;">
                  <p style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:7.2pt;line-height:normal;font-size:13px;font-family:"Verdana",sans-serif;text-align:center;'><strong><span style='font-size:13px;font-family:"Verdana",sans-serif;color:black;'>Entitlement Description</span></strong></p>
                </th>
                <th style="background: rgb(255, 192, 0);vertical-align: top;">
                  <p style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:7.2pt;line-height:normal;font-size:13px;font-family:"Verdana",sans-serif;text-align:center;'><strong><span style='font-size:13px;font-family:"Verdana",sans-serif;color:black;'>Display Name</span></strong></p>
                </th>
                <th style="background: rgb(255, 192, 0);vertical-align: top;">
                  <p style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:7.2pt;line-height:normal;font-size:13px;font-family:"Verdana",sans-serif;text-align:center;'><strong><span style='font-size:13px;font-family:"Verdana",sans-serif;color:black;'>Business Justification</span></strong></p>
                </th>
              </tr> ${entitlementshtmltablerowsv3}
              </table><% }%><br><br>
        

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