Click HERE to see how Saviynt Intelligence is transforming the industry. |
06/08/2024 03:38 AM - edited 06/08/2024 03:46 AM
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
06/08/2024 08:39 AM - edited 06/08/2024 08:40 AM
<%
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});
}
}
%>
06/08/2024 11:06 AM
Hi @rushikeshvartak , above didn't work.
06/08/2024 11:42 AM
@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} } %>
06/09/2024 01:13 AM
@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);
}
}
%>
06/09/2024 09:48 PM
can you share results