ServiceNow List Collector sysID to displayName on catalog task

IT Eric
Tera Contributor

I have a catalog item that contains a list collector that i will use to populate the description field of a catalog task.

find_real_file.png

 

When i use this variable, the sysID of the server selected is populated instead of the displayName
find_real_file.png

 

If i try to drill down into the variable and select the name (pulling from the cmdb_ci_server) table, it shows blank on the task. 
find_real_file.png

I've set the display field on the table to be the name but it still shows the sysID.

What should be the correct way in getting the displayName for these?

1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi

a list collector field is just a String field with a comma-separated list of Sys IDs.

If you need the display names you have to iterate over the Sys IDs and lookup the relating records.

See the following article if you want to know how to build that: https://community.servicenow.com/community?id=community_blog&sys_id=e244e902dbcc2010fb4ae15b8a9619c3

Kind regards
Maik

View solution in original post

5 REPLIES 5

Maik Skoddow
Tera Patron
Tera Patron

Hi

a list collector field is just a String field with a comma-separated list of Sys IDs.

If you need the display names you have to iterate over the Sys IDs and lookup the relating records.

See the following article if you want to know how to build that: https://community.servicenow.com/community?id=community_blog&sys_id=e244e902dbcc2010fb4ae15b8a9619c3

Kind regards
Maik

Thanks for the reply and pointing me to that blog post!
Looks like i'm having issues others were having in that article where it's not properly moving over to an array.object - stuck as a string. 


Matt Small1
Tera Expert

I have found you can use  the getDisplayValue() method to return the display name for the record(s) chosen in the list collector variable.

var list = current.variables.ad_group;
var display = current.variables.ad_group.getDisplayValue();
gs.print(list);
gs.print(display);
 
*** Script: d554f530878bc150e23b52883cbb350d,e3643d30878bc150e23b52883cbb355f
*** Script: group1, group2

 

thanks!