- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2022 07:22 AM
How can we get text from glidelist and populate that in the string field? Is it possible through GlideAjax and script include? If Yes, Please suggest me the solution.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2022 07:47 AM
A glidelist contains a comma separated list of sys_ids.
In this server javascript, value is the value of the glidelist and tablename is the name of the referenced table. The procedure is
- Split the glidelist into an array
- Look up each of those sys_id values in the referenced table
- Get the display value and push it onto a new array
- Join the display values together and return as a string
var listSysID = value.toString().split(',');
var listDisplay = [];
for (var i = 0; i < listSysID.length; ++i) {
var grRef = new GlideRecord(tablename);
grRef.get(listSysID[i]);
listDisplay.push(grRef.getDisplayValue());
}
var result = listDisplay.join(',');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2022 07:47 AM
A glidelist contains a comma separated list of sys_ids.
In this server javascript, value is the value of the glidelist and tablename is the name of the referenced table. The procedure is
- Split the glidelist into an array
- Look up each of those sys_id values in the referenced table
- Get the display value and push it onto a new array
- Join the display values together and return as a string
var listSysID = value.toString().split(',');
var listDisplay = [];
for (var i = 0; i < listSysID.length; ++i) {
var grRef = new GlideRecord(tablename);
grRef.get(listSysID[i]);
listDisplay.push(grRef.getDisplayValue());
}
var result = listDisplay.join(',');