Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

Email template - If else condition checking endpointname

piyushm
Regular Contributor II
Regular Contributor II

Hello,

In the approval notification, I need to print in the body based on the endpointname. 

I want to print dynamic attribute value if endpointname ="ABC" else print the table ${entitlementshtmltablerows}

I tried using below syntax but it is failing with error "groovy.lang.MissingPropertyException: No such property: print for class: SimpleTemplateScript2042"

 

<%
if(endpoint=='ABC') print "${accessItems.collect{ it.request_access_attrss.find{it.attributeName.toString().equalsIgnoreCase('DynamicAttrName')}.collect{it.attributeValue}}}"
else print
"<table border='1' cellpadding=\"0\" cellspacing=\"0\"><tr><th>Application</th><th> Entitlement Name(s) </th> <th> Description </th> <th> Glossary </th> </tr> ${entitlementshtmltablerows} </table>" %>

 

Any input on what could be the issue?

4 REPLIES 4

rushikeshvartak
All-Star
All-Star

<%
if(endpoint=='ABC') print "${accessItems.collect{ it.request_access_attrss.find{it.attributeName.toString().equalsIgnoreCase('DynamicAttrName')}.collect{it.attributeValue}}}"
else {print
"<table border='1' cellpadding=\"0\" cellspacing=\"0\"><tr><th>Application</th><th> Entitlement Name(s) </th> <th> Description </th> <th> Glossary </th> </tr> ${entitlementshtmltablerows} </table>" %>}


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

piyushm
Regular Contributor II
Regular Contributor II

@rushikeshvartak  With this I am getting below error.

"log":"SimpleTemplateScript1875.groovy: 8: expecting '}', found '' @ line 8, column 40.\n","stream":"stdout","

If I don't use "{" in else and remove space from my original logic, then the template is executed but it is going to the else block.

 

<%
if(endpoint=='ABC') print "${accessItems.collect{ it.request_access_attrss.find{it.attributeName.toString().equalsIgnoreCase('DynamicAttr')}.collect{it.attributeValue}}}"
else print "<table border='1' cellpadding=\"0\" cellspacing=\"0\"><tr><th>Application</th><th> Entitlement Name(s) </th> <th> Description </th> <th> Glossary </th> </tr> ${entitlementshtmltablerows} </table>"%>

Print ${endpoint} variable and check if its matching or not also use condition like below

 

endpoint.equalsIgnoreCase('ABC')


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

piyushm
Regular Contributor II
Regular Contributor II

Endpoint variable alone doesn't fetch the name in If condition it seems.

I tried endpoint.endpointname  and it is working as expected.

<% if(endpoint.endpointname=="ABC") print "${accessItems.collect{ it.request_access_attrss.find{it.attributeName.toString().equalsIgnoreCase('DynamicAttr')}.collect{it.attributeValue}}}"
else print "<table border='1' cellpadding=\"0\" cellspacing=\"0\"><tr><th>Application</th><th> Entitlement Name(s) </th> <th> Description </th> <th> Glossary </th> </tr> ${entitlementshtmltablerows} </table>"%>