
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2018 12:55 PM
I have a requirement where I need to display what was selected in a list collector in a text box along with some other fields. I tried using g_form.getDisplayBox('variable name').value which has been mentioned in some other posts for reference fields but that does not seem to work for list collectors. How can I achieve this requirement.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2018 05:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2018 05:07 AM
Never got a solution or figured it out. This is no longer a requirement for me.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2018 12:57 PM
It doesn't looks like it is possible to do it using g_form. What I ended up doing was using script include to send my array of sys_ids and then returned an array of the display values and then called a function to update my multi-line text box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 11:47 AM
Hi Brian,
I'm working on the similar requirement. Can you please post the script include you have used to return the display values of list collector? Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2020 07:59 AM
I had to use an on change client script that would call the script include sending it the value(s). The script include would then return an array of the field that contained what I wanted to display. In essence the field that was set to display. In my case I think it was called name. I don't have access to the code anymore as I no longer work for that company. I will see if I can reproduce it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2020 08:39 AM
Here is the script include I used. It allows me to query any table. The Comments lines at the top are the parameters to use.
Table data query script include
//Get Data from a service now table.
//parameters:
//sysparm_query_table : name of tabel
//sysparm_query_encodedQuery : encoded query to run on the table
//sysparm_query_fields : fields to return from table
//sysparm_query_order: field to order data by
var TableDataQuery = Class.create();
TableDataQuery.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getList: function () {
var table = this.getParameter('sysparm_query_table');
var encodedQuery = this.getParameter('sysparm_query_encodedQuery');
var propertiesString = this.getParameter('sysparm_query_fields');
var orderBy = this.getParameter('sysparm_query_order');
var request = new GlideRecord(table);
request.addEncodedQuery(encodedQuery);
request.orderBy(orderBy);
request.query();
var list = [];
while (request.next()) {
if (propertiesString != null && propertiesString != "") {
var responseObject = {};
var properties = propertiesString.split(",");
for (var i = 0; i < properties.length; i++) {
gs.print(properties[i]);
responseObject[properties[i]] = request[properties[i]].toString();
}
list.push(responseObject);
} else {
list.push(request);
}
}
return JSON.stringify(list);
},
type: 'TableDataQuery'
});