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

Sohail Khilji
Kilo Patron
Kilo Patron

@Samiksha2 ,

 

This will not work as expected. List collecter field has this limitation i guess. you go to create a seprate action for this activity and call it in your flow. 

 

i hope i helped you...

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Hi @Sohail Khilji ,

Please help me in creating action.

@Samiksha2 ,

 

Follow this steps > https://www.servicenow.com/community/developer-blog/using-list-collector-in-flow-designer-for-each-l...

 

kindly mark the ANSWER Correct if it addresses your concern so that i goes to answered queue...

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Maik Skoddow
Tera Patron
Tera Patron

Hi @Samiksha2 

sorry, neither I cannot read your thoughts nor I have access to your instance.

So please provide more details and context information.

Maik