Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Get the display value of list collector variable values selected through flow designer

Phanideepthi
Tera Contributor

Hi All,

 

We are working on a catalog item where we have a list collector variable("additional services") getting from question_choice table . Now we need to get the values selected in the list collector into request description. When we are adding the variable it is populating with sysID's of the values selected. So now how can we get the text values using a flow designer. 

Phanideepthi_0-1763388943210.png

 

 

Thanks in advance.

11 REPLIES 11

Nawal Singh
Tera Guru

Hi @Phanideepthi ,

I have tested the below logic in my pdi and its working fine!!

In flow designer you need to write the field level script like below in - 

NawalSingh_1-1763391178185.png

 

here is the sample logic- (it returns to Description fields)

 

 var members= fd_data._1__get_catalog_variables.group_members; var choices="";
var gr= new GlideRecord('sys_user');
gr.addEncodedQuery('sys_idIN'+members);
gr.query();
while(gr.next()){
choices=choices+" , "+gr.getDisplayValue('name');}
return choices;

 

If you found my response helpful, please mark it as helpful and accept it as the solution.

Thank you
Nawal Singh

 

Hi @Nawal Singh ,

 

Thanks for your reply. If I want to add more details to the description how should I add them? Scripting is flow designer is new to me didnt tried before.

Hi @Phanideepthi ,

I know scripting is not that much easy but I checked alternative way as well. but in this case your variables providing list of sys_id then we need to build a logic and based on the ids need to fetch the display values... in shared screenshot I explain how we can retrieve the value and set to the specific fields.

 

Please try once and let me know if you still facing any issue I will assist you further!!

 

If you found my response helpful, please mark it as helpful and accept it as the solution.

Thank you
Nawal Singh 

Ankur Bawiskar
Tera Patron
Tera Patron

@Phanideepthi 

you can create a flow variable of type string and then use "Set Flow Variables" flow logic to grab the label instead of sysId

Then use this flow variable in your flow

Flow variables 

Set Flow Variables Flow Logic 

something like this but please enhance

AnkurBawiskar_1-1763466566370.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader