The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to convert List collector to String in flow designer?

Harsh3842
Tera Contributor

Hi Everyone,

 

I have a requirement where for a field multiple user needs to be selected at a same time. That's why I have used a List Collector as type for that variable. Once the form is getting submitted on the RITM description sysid are populating for that variable. I want the name of the user selected on the portal to be shown in the description of RITM and I am using a flow designer. How can I achieve that.

 

 

 

Thanks,

Harsh

1 REPLY 1

Babu Govind
Tera Contributor

Hi @Harsh3842,

 

Good day!

 

1. You can create Flow variables in the flow.

Naveen2_0-1742199365975.png

 

2. Once the flow variables are created. Please use the Flow logic to set the flow variables

 

Naveen2_1-1742199960091.png

 


3. You can set the variable value using script as mentioned below.

 

var readID = 'List variable'; // List field from the flow
var readName = getName(readID);
return readName;

function getName(ids){
var sysId = ids.split(',');
var name=[];
for(var i = 0 ; i < sysId.length ; i++){
	var accountName = new GlideRecord('reference_table_name'); // Reference table of the list field.
	accountName.get(sysId[i]);
	name[i] = accountName.'field_name'; // Name/String which needs to be displayed
}
var name_str = String(name); // Convert the array to string and return to the function
return name_str;
}

 Hope this information is helpful.

 

Best Regards,

Naveen