Any way to make a List Collector return a name instead of a sysid

Corsair831
Tera Contributor

On a catalog item I'm using a list collector to return one or multiple variables from a custom table.

 

I'm running a simple client script to convert this result to a string (.toString()) and then populating a custom field with the result. The problem is it's coming out as a sysid.

 

Is there any capability within a client script to obtain the display value which is being shown on the list collector, rather than a sysid? It's clearly being returned to the catalog item as it's displayed in the list collector; there surely must be some way within the script to obtain that value rather than just a sysid?

 

If not I'm just going to have to hard code it, which I would rather avoid if possible.

 

--

Big picture - As an aside, the reason for the ask is that the list collector is ugly on the backend; is there perhaps some alternative to a list collector when you want to select multiple variables? Currently we've got a custom choice table and are using that, as I can't see any way to have a few choices on the cat item itself where you can select multiple? 

 

Many thanks,

Jake

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron

Hi Jake,

I see 2 options

Option 1:

Get the custom field changed to reference and you get what you want without additional effort to get displayvalue 

 

Option 2:

Apply additional GlideRecord(at script include or any server side code) to return the displayvalues.

View solution in original post

4 REPLIES 4

Jaspal Singh
Mega Patron

Hi Jake,

I see 2 options

Option 1:

Get the custom field changed to reference and you get what you want without additional effort to get displayvalue 

 

Option 2:

Apply additional GlideRecord(at script include or any server side code) to return the displayvalues.

Thank you, I will give these a try

 

Jake

Ankur Bawiskar
Tera Patron

@Corsair831 

list collector will always return sysIds, there's no other way it will give you display value

you can use client script + GlideAjax and pass the sysIds and script include will return the display value

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you, that's very strange, you would have thought you would be able to access the display value as that is also returned, oh well, thanks anyway!