List collector Script ServiceNow | Populate List Collector Values in String Field

This article will provide you complete understanding of list collector variable type in ServiceNow. Along with video demonstration we have shared the script which helps you to implement the ServiceNow list collector in your developer instance. We have given the use case example below to implement the same in any requirement.

Table of Content
  • What is List Collector Variable type in ServiceNow?
  • How many items a List Collector display at a time?
  • How to split List Collector Values in ServiceNow
  • List collector Script ServiceNow
  • Use Case: How to get list collector values and populate in string field
  • Video demonstration of ServiceNow List Collector

Example of List Collector Variable, Script Example of List Collector Variable

What is List Collector Variable Type in ServiceNow?

List collector is a catalog item variable type in ServiceNow where we can select multiple values or records of a referencing table in a single go, actually it is having slush bucket where we can select and deselect multiple values or records easily. In ServiceNow, reference field allows to select only single value or record at a time, so if there is requirement to select multiple record in single go then we use list collector in ServiceNow. For e.g., we have to create a field where we have to select trainees for any training. Means we need a variable for multiple user selection so in that case we can use list collector variable in a form. Below is the screenshot of list collector variable:

List Collector Variable Form:

list collector attributes servicenow,add value to list collector servicenow,list collector select multiple,list collector reference qualifier

Slush Bucket develop through list collector look in the Catalog item:

list collector attributes servicenow,add value to list collector servicenow,list collector select multiple,list collector reference qualifier

What is List Collector Variable type in ServiceNow?

list collector variable slush bucket displays a maximum number of 100 items in a list. After moving some items to the Selected list, we can again click Run Filter to refresh the Available list or can type the text to filter the data in slush bucket. This action will add more available items to the list, to a maximum of 100 items. Means at a time only 100 items will be displayed and we can filter the data again and again as per our requirement search.

List collector Script ServiceNow:

The below script is from the use case scenario we have implemented in our personal developer instance:

Use case: In the read only multiline text box field display all the email of the users selected in List Collector field using client script basically this use case is an example that how to get list collector values and populate in string field.

There are lots of way to implement the above use case, below we have shared one of the way to implement the above use case:
Below is the example of onchange client script, which will execute on the change of list collector field:

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
//get list collector values and populate in string field
var traineeEmailCollection=[];
var traineeNameList=g_form.getValue('u_select_trainee_names'); 
// give here list collector variable name in above syntax
var trainees=traineeNameList.split(',');
for (var i=0; i < trainees.length; i++) {
var gr = new GlideRecord('sys_user');
// Give the required field name where you need list collector values in above syntax

Video demonstration of ServiceNow List Collector:

In below you tube link we have practically implemented the above use case scenario along with required understanding of ServiceNow list collector script and implementation of the variable in ServiceNow catalog item.

We hope all the information shared above related to list collector in ServiceNow will be helpful and the list collector script will help you to implement your requirement in you ServiceNow personal developer instance by doing small customization in the scripts. If you have any questions or queries related to above topic then feel free to ask below in comment section below and please do not forget to provide you feedback below.


  1. it does not work for me. currently i am using the rome version. The email is not populating, although it is fetching the sys_ids but it is not showing the email

  2. Hi Same for me, I am using San diago version and it is not working

  3. Hey guys, it works for me on desktop, but there is a little mistake on line 15 - there should be "gr.addQuery();". Also do not forget to set the variable name. It not works on SP because console says u must call query from function.

  4. this code is working agent view side but not work in Portal side.

    1. select UI type ALL then its working service portal

  5. Should this work in the Employee Center Core scope? I have tried this code on catalog client script for HR record producer and having no luck?


Thankyou !!!!

Powered by Blogger.