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

Analytics in email template

NM
Honored Contributor II
Honored Contributor II

Hi Team,

we have a use case where we have to loop through all the reportee for a specific manager and if the person email ID is equal to abc@xyz.com we have to print username otherwise emailID.

I have tried multiple things in mail template, but nothing seems to work

sample 1 - <% int count=Integer.parseInt("${ANALYTICSDATA.size()}"); for(int i=0;i<count;i=i+1){if(${ANALYTICSDATA.'email'[i]}=="abc@xyz.com")print "app - ${ANALYTICSDATA.'email'[i]" else print "xyz - ${ANALYTICSDATA.'username'[i]"} %>

it didn't work out.

Can anyone please help out?

Thanks

5 REPLIES 5

rushikeshvartak
All-Star
All-Star

<%
int count = Integer.parseInt("${ANALYTICSDATA.size()}");
for (int i = 0; i < count; i++) {
if ("abc@xyz.com".equals(${ANALYTICSDATA.get(i).email})) {
print("app - " + ${ANALYTICSDATA.get(i).email});
} else {
print("xyz - " + ${ANALYTICSDATA.get(i).username});
}
}
%>


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

NM
Honored Contributor II
Honored Contributor II

Hi @rushikeshvartak , above didn't work.

NM
Honored Contributor II
Honored Contributor II

@rushikeshvartak , tried this too didn't work, just wanted to check whether it is printing the value or not.

<% int count = Integer.parseInt("${ANALYTICSDATA.size()}"); for (int i = 0; i < count; i++) {"xyz@com".equals(${ANALYTICSDATA.get(i).email})? ${ANALYTICSDATA.get(i).email}:${ANALYTICSDATA.get(i).username} } %>

@NM  try below

<%
int count = ((List)request.getAttribute("ANALYTICSDATA")).size();
List<Map<String, String>> analyticsData = (List<Map<String, String>>) request.getAttribute("ANALYTICSDATA");

for(int i = 0; i < count; i++) {
Map<String, String> data = analyticsData.get(i);
String email = data.get("email");
String username = data.get("username");

if ("abc@xyz.com".equals(email)) {
out.print("app - " + email);
} else {
out.print("xyz - " + username);
}
}
%>


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

can you share results


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