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

Hello @Sohail Khilji,

Yes you are right in get catalog variable we are getting comma separated values but that return sysId’s of groups so if we want the name of the group.We need to use  'fd_data._1__get_catalog_variables.groups' and then glide the record in script section and also fd_data._1__get_catalog_variables.groupsis used in script section of flow only.

 

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

 

Regards,

Vaishnavi Shinde

Can we fetch other fields values depend on list collecter value in the email? 

Suppose my list collecter is  for user name  and I want  whatever users selected in the list collecter those users emails should be add in the email body  can we do that and how?