- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 05:56 PM
Hi All,
I have record producer with a variable List Collector referring to cmdb_ci table and mapped to text field (short description on Incident table ) so when I submit this form it displays sysid's of below selected CI's in Short Description field as highlighted in below screens.Is there any way to show theDisplay Value(Name) of CI's in Short Description field.
Appreciate your response !
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 07:44 PM
Please try the below script
var test = producer.YOUR_FIELD_NAME.toString();
if (test != '') {
var myString1Split = test.split(',');
var str = '';
for(i = 0; i < myString1Split.length; i++) {
var mylst = new GlideRecord('cmdb_ci');
mylst.addQuery('sys_id', myString1Split[i]);
mylst.query();
while(mylst.next()){
str += mylst.name + ', ';
}
}
current.short_description = str;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 07:25 AM
FYI, you don't have to use a script to iterate over the sys_ids. As I mentioned before, you simply need to do
current.short_description = producer.selected_list.getDisplayValue(); // replace selected_list with your variable name
and it'll populated Short Description with the Display Values of the sys_ids like below:
This is a simpler and more maintainable solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2018 10:04 PM
Dear drjohnchun
Would you be able to explain where shall I use that syntax?
Is it on record producer or incident form it should be implemented?
Additionally in which particular place i.e. script section of record producer/incident form ?
Apologies for perhaps basic questions but I am very new to servicenow .
Thanks in advance for your help
Jacek