Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

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

Not applicable

@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...

 

Hi @Community Alums ,

Please help me in creating action.

Not applicable

@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...

 

Maik Skoddow
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