Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

Pushing name instead of SysID in XML of Requested Item

Vee Jay Recana
Giga 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

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

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

 

Ravi Gaurav
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(','));