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

Get displayname of entitlement in email template (set on "Create Entitlement" task completion)

yogesh2
Regular Contributor II
Regular Contributor II

I want to print the "displayname" of the entitlement (AADGroup) being created in an email template.

The email is being triggered from endpoint on the completion of "Create Entitlement" task. The application is using "AzureAD" connector and entitlement type is "AADGroup"

I have tried below objects to no avail so far:

${entitlement}  // only prints "[]"
${task?.entitlement_valueKey?.entitlement_value}  // prints "null"

 Please suggest some variables that I can check, the documentation is of no help.

I tried below code to see all the exposed objects but that too is not working anymore in v24.5

${this.binding.variables.each {k,v -> println "$k = $v" + "<br>"}}
9 REPLIES 9

Raghu
All-Star
All-Star

@yogesh2  try below

${task?.entitlement_valueKey?.displayname}

and

${entitlement_values.collect{it.toString().indexOf("(") == -1 ? it : it.toString().substring(0, it.toString().indexOf("(") -1)}.toListString().replaceAll('\\[|\\]','')}

Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

yogesh2
Regular Contributor II
Regular Contributor II

first one sends "null" in the email:

yogesh2_0-1717993941950.png

when I use second one no email is sent and I see this error:

 2024-06-10T04:24:54.292+00:00 ecm-worker services.ArsTaskService quartzScheduler_Worker-4-wgxk8 ERROR Exception occured while fetching requestid = java.lang.NullPointerException: Cannot invoke method get() on null object 
 2024-06-10T04:24:54.292+00:00 ecm-worker services.ArsTaskService quartzScheduler_Worker-4-wgxk8 DEBUG Start:prepareAndTriggerTaskCreateEmail 
 2024-06-10T04:24:54.292+00:00 ecm-worker services.ArsTaskService quartzScheduler_Worker-4-wgxk8 DEBUG End:prepareAndTriggerTaskCreateEmail 
 2024-06-10T04:24:54.292+00:00 ecm-worker services.ArsTaskService quartzScheduler_Worker-4-wgxk8 DEBUG Inside updateProvisioningTries.. 



 

rushikeshvartak
All-Star
All-Star

Share output of binding code you received 


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

yogesh2
Regular Contributor II
Regular Contributor II

no email is sent when I use 

${this.binding.variables.each {k,v -> println "$k = $v" + "<br>"}}

 This is the error I see in logs:

 2024-06-10T04:24:54.292+00:00 ecm-worker services.ArsTaskService quartzScheduler_Worker-4-wgxk8 ERROR Exception occured while fetching requestid = java.lang.NullPointerException: Cannot invoke method get() on null object 
 2024-06-10T04:24:54.292+00:00 ecm-worker services.ArsTaskService quartzScheduler_Worker-4-wgxk8 DEBUG Start:prepareAndTriggerTaskCreateEmail 
 2024-06-10T04:24:54.292+00:00 ecm-worker services.ArsTaskService quartzScheduler_Worker-4-wgxk8 DEBUG End:prepareAndTriggerTaskCreateEmail 
 2024-06-10T04:24:54.292+00:00 ecm-worker services.ArsTaskService quartzScheduler_Worker-4-wgxk8 DEBUG Inside updateProvisioningTries.. 

Share email template screenshot.


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

yogesh2
Regular Contributor II
Regular Contributor II

yogesh2_0-1718000382749.png

 

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 this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

yogesh2
Regular Contributor II
Regular Contributor II

I have tried with hardcoded email too, but still same error in logs and not receiving any email

yogesh2_1-1718083723142.png

It used to be so easy to troubleshoot emails with this code and now even this has stopped working in recent versions 🙁

Check logs


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