Show List collector value in the email created in Flow designer

Samiksha2
Mega Sage

Hi All,

 

I have added send email action in the Flow designer to send variables in the email.

 

List collector values are not populating in the email. Is there any way to show List collector value?

 

Samiksha2_0-1703150084775.png

Please help in this.

 

Thanks, 

Sam

1 ACCEPTED SOLUTION

VaishnaviShinde
Kilo Sage

Hello @Samiksha2 

 

If I understood correctly, you have to add the list collector values to the email body. You can try the below script in body section of "Send Email" action. 

 

In the below highlighted section you can add the script. 

VaishnaviShinde_0-1703153155895.png

 

 

var originalGroup = [];
var groups = fd_data._1__get_catalog_variables.groups; // You can take your get catalog variable number
gs.info('Groups:'+groups.length);
var listSplit = groups.split(',');
gs.info("MS 29==" + listSplit);

for (var i = 0; i < listSplit.length; i++) {
originalGroup.push(listSplit[i]);
}
gs.info("MS 18 ==" + originalGroup.length);
var string = "this are the groups:";
var group="";
for(var i=0;i<originalGroup.length;i++){
var groupGr= new GlideRecord('sys_user_group');
groupGr.addQuery('sys_id',originalGroup[i]);
groupGr.query();
if(groupGr.next()){
if(group == ''){
string = string+ ', '+ groupGr.name;
}else{
string = ', '+ groupGr.name;
}
}
}
return string;
 
Output 
VaishnaviShinde_1-1703153235884.png

 

This works for me.

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Vaishnavi Shinde

 

 
 

View solution in original post

16 REPLIES 16

Hi @Maik Skoddow ,

I have a list collector variable in the form.

whatever value selected but the user that should be populate in the email notification.
So i have added Send email action in the floe designer and added the list collector there.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Samiksha2 

 

Please help to understand, what you are storing in list collector. My experience say, it is not a possible case to get the list collector in email body.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG ,

 

someone from my previous organization has done this in FD. But i have no idea how they had done in FD. 

Right now sys id is populating. 

 

VaishnaviShinde
Kilo Sage

Hello @Samiksha2 

 

If I understood correctly, you have to add the list collector values to the email body. You can try the below script in body section of "Send Email" action. 

 

In the below highlighted section you can add the script. 

VaishnaviShinde_0-1703153155895.png

 

 

var originalGroup = [];
var groups = fd_data._1__get_catalog_variables.groups; // You can take your get catalog variable number
gs.info('Groups:'+groups.length);
var listSplit = groups.split(',');
gs.info("MS 29==" + listSplit);

for (var i = 0; i < listSplit.length; i++) {
originalGroup.push(listSplit[i]);
}
gs.info("MS 18 ==" + originalGroup.length);
var string = "this are the groups:";
var group="";
for(var i=0;i<originalGroup.length;i++){
var groupGr= new GlideRecord('sys_user_group');
groupGr.addQuery('sys_id',originalGroup[i]);
groupGr.query();
if(groupGr.next()){
if(group == ''){
string = string+ ', '+ groupGr.name;
}else{
string = ', '+ groupGr.name;
}
}
}
return string;
 
Output 
VaishnaviShinde_1-1703153235884.png

 

This works for me.

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Vaishnavi Shinde

 

 
 

Hi @VaishnaviShinde ,

 

Thanks for reply.

But I have to show value selected in the from.

Areas is a list collector (table is cmn_location).

Also with that there are more values should be populated. if I use script then I cannot add other variables.

 

Thanks,

Sam