Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Bring a dynamic attribute (a Plain Text Field) in Email Template

Saviynt_Savvy
Regular Contributor
Regular Contributor

Hello all,

In the ARS, we have a Dynamic attribute named 'Additional Comments' which is a Plain Text Field.
And we need to enter the comments regarding the requesting access as shown in the screenshot below.

Saviynt_Savvy_0-1719561789251.png
How to bring this value in the Email template?

I have used both the below syntaxes:
${accessItems.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('Additonal Comments')} .collect{it.attributeName.toString() + ': ' + it.attributeValue}.join('###')}.toString().replaceAll('\\[','').replaceAll('\\]','').replaceAll('\\,','')}

${dynamicAttrsList.find{ it.attributeName?.equalsIgnoreCase('Additonal Comments') }?.attributeValue}

And I got the below error:

Saviynt_Savvy_1-1719562138223.png

We see the above error in the Email History Job log details.
It is saying that , there is no such property called 'IT'. 'it' is a keyword causing the issue here.

Any suggestions please!

Thanks & Regards,
SaviyntSavvy

8 REPLIES 8

SumathiSomala
All-Star
All-Star

@Saviynt_Savvy Where did you attach this email template and when this will be triggered?

https://forums.saviynt.com/t5/identity-governance/using-dynamic-attribute-in-email-template/m-p/3945...

 

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.

Hello @SumathiSomala ,

I am using the email template in Workflow as shown in the below screenshot.

Saviynt_Savvy_0-1719960320775.png

Thanks & Regards,
SaviyntSavvy

PremMahadikar
All-Star
All-Star

Hi @Saviynt_Savvy ,

Try below:

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

OR

${task?.requestAccessKey?.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('Premdynamicattribute')}.collect{it.attributeValue}}.get(0)}

 

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

rushikeshvartak
All-Star
All-Star

Are you storing attribute in accounts column ?


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

Hello @rushikeshvartak ,

Yes, I am storing the attributes in the accounts column, 'CUSTOMPROPERTY11' and I am using it in the Workflow, which is attached to a Security System.

Saviynt_Savvy_1-1719960534339.png

Thanks & Regards,
Saviynt Savvy

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

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

Hello @rushikeshvartak ,

I am using the below body in Email template:

<div>Hello ${requestor.username},</div><br><div>A request has been sent to ${assignee.username} for approval with Request ID - ${requestid}.<br><br><b>Request:</b>${accessItems.collect{it.request_access_attrss.find{it.attributeName.toString().equalsIgnoreCase('Additional Comments')}.collect{it.attributeValue}}}.<br><b>Justification:</b> ${task.comments}.</div><br><div>Thank you!<div/><div>Identity Access Management</div>

The dynamic attribute name is 'Additional Comments' and when I submit a request and run the 'Email History Job', the job fails and I see the below error in the Job Log Details:

Saviynt_Savvy_1-1719974048534.png

I receive the email like below:
Saviynt_Savvy_0-1719973511004.png
Any other syntax to check !

Thanks & Regards,
SaviyntSavvy

Remove ${task.comments} from email body

${task.comments} will not resolve as request is not approved yet 

 

 

----------------------------------

FYI

Please validate supported variables.

Purpose :

To get what variables are present to use in the email template.

Email Template steps :

keep Advanced HTML CSS flag is checked

Keep your email Address in TO

TO /CC/BCC & Subject - Don't use any dynamic variables

Add only below code in Email Body
${this.binding.variables.each {k,v -> println "$k = $v" + "" + "br" + ">"}}

Output : using the below expression. By putting it in the email body, it will print all variable names with values, and then accordingly, you can use it:


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