The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Pushing name instead of SysID in XML of Requested Item

Vee Jay Recana
Mega Guru

HI Community,

 

I have a requirement wherein when a request has been submitted for a specific catalog item, a list collector variable is pushing the value in the XML as sys_id. In the frontend/form, it is showing name. I want to push name as well on the XML so that it is uniform. Is there any way to possibly do that?

VeeJayRecana_0-1758771710701.png

VeeJayRecana_1-1758771800513.png

 

3 REPLIES 3

AshishKM
Kilo Patron
Kilo Patron

Hi @Vee Jay Recana ,

As list collector point to table and show all records from table, that's the reason its showing sys_id of each record.  Here in this case, first 3 values are listed as Name Value and last one sys_id. Did you check why first 3 are showing name only instead of sys_id.

 

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

They were updated from the Native UI. The sys_id was updated from a catalog item.

 

Ravi Gaurav
Giga Sage
Giga Sage

Hi @Vee Jay Recana 

When processing the RITM or the variable in script (e.g., Business Rule, Workflow, Flow Designer), you can split the sys_ids and fetch their display values:

Sample Script :-

 

var selectedValues = current.variables.your_list_collector; // sys_ids
var ids = selectedValues.split(',');
var names = [];

for (var i = 0; i < ids.length; i++) {
var gr = new GlideRecord('target_table'); // e.g., sys_user if list collector is users
if (gr.get(ids[i])) {
names.push(gr.getDisplayValue()); // get display name
}
}

gs.info("Selected Names: " + names.join(','));

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/