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

Dynamic attribute in email template

NM
Honored Contributor II
Honored Contributor II

Hi Team,

we have to print a value based on dynamic attribute value chosen by user while submitting the request.

I tried comparing the value, but email fails

Tried these 2 didn't work

<% if ("${accessItems.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('DAJUST')}.collect{it.attributeValue}}.get(0).toString().replace('[','').replaceA(']','')}"=="other") print "test1" else print "testelse" %>

<% if (${accessItems.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('DAJUST')}.collect{it.attributeValue}}.get(0).toString().replace('[','').replaceA(']','')}=="other") print "test1" else print "testelse" %>

if any other way we can compare dynamic attribute and its value.

Thanks

@rushikeshvartak @PremMahadikar @naveenss , anything which I can try for above query.. bit urgent for us

6 REPLIES 6

PremMahadikar
All-Star
All-Star

Hi @NM ,

Did you try below code from documentation?

 

${accessItems.findAll{it.request_access_attrss.size()}.collect{it.request_access_attrss.findAll{!it.attributeName.toString().equalsIgnoreCase('ENT_BY_RULE_ADD'))}.collect{it.attributeName.toString() + ':' +it.attributeValue}.join('###')}}

Obtains all the dynamic attributes in the request.

${accessItems.collect{ it.request_access_attrss.find{it.attributeName.toString().equalsIgnoreCase('Location')}.collect{it.attributeValue}}.get(0)}

${accessItems.collect{ it.request_access_attrss.find{it.attributeName.toString().equalsIgnoreCase('Location')}.collect{it.attributeValue}}}

where, Location is the dynamic attribute name.

Obtains the name of a particular dynamic attribute and its value f

If this helps, please consider selecting Accept As Solution and hit Kudos

When I try this I get this error while saving the email template"Operation not allowed as you are entering a value that resembles or contains script code"

"${accessItems.findAll{it.request_access_attrss.size()}.collect{it.request_access_attrss.findAll{!it.attributeName.toString().equalsIgnoreCase('ENT_BY_RULE_ADD'))}.collect{it.attributeName.toString() + ':' +it.attributeValue}.join('###')}}"

NM
Honored Contributor II
Honored Contributor II

Hi @shine,

Till this part it will print

${accessItems.collect{ it.request_access_attrss.find{it.attributeName.toString().equalsIgnoreCase('Location')}.collect{it.attributeValue}}.get(0)}

shine
New Contributor
New Contributor

I tried-

${accessItems.findAll{it.request_access_attrss.size()}.collect{it.request_access_attrss.findAll{!it.attributeName.toString().equalsIgnoreCase('ENT_BY_RULE_ADD'))}

 

"Operation not allowed as you are entering a value that resembles or contains script code" is the error I get while saving it 

NM
Honored Contributor II
Honored Contributor II

Try below @shine 

${accessItems.collect{ it.request_access_attrss.find{it.attributeName.toString().equalsIgnoreCase('Location')}.collect{it.attributeValue}}.get(0)}

 

NM
Honored Contributor II
Honored Contributor II

Hi @PremMahadikar , I was able to print the value but comparing the dynamic attribute with multiple value wasn't working but i was able to figure it out.. 

Thank you for your help!!