and more in a single search tool across platforms. Read the announcement here. |
05/10/2023 06:34 PM
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?
Solved! Go to Solution.
05/10/2023 08:10 PM
<%
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>" %>}
05/11/2023 03:38 PM
@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>"%>
05/11/2023 04:27 PM
Print ${endpoint} variable and check if its matching or not also use condition like below
endpoint.equalsIgnoreCase('ABC')
05/11/2023 04:42 PM
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>"%>