How to show the value instead of sys id for a value in a table that's not being referenced anymore

simran3
Tera Contributor

I have a field on a catalog item that used to reference a table for years for laptop types, client recently wanted to change the options of the select box to display Laptop and Standard Laptop instead of the laptop type so I didn't reference the table anymore and changed the field to a regular select box and created Question Choices for the new values. Now the client is unhappy because the old laptop type values from the table are now being displayed as sys IDs in reports. How can I make the sys IDs show the display value of those laptop types instead like it used to and still keep the new choices under a regular select box?

4 REPLIES 4

Kieran Anson
Kilo Patron

You would need to revert your modifications, and create a new variable rather than changing the type of the original.

 

That, or create a fix script to update every sysId value to it's equivalent choice value. Which could break in-flight workflows. 

Shivalika
Mega Sage

Hi @simran3 

 

 

Just run a fix script to update it to name. But yes the reference will be gone, so just check if the variable values are being referenced anywhere else. Like in a flow if you have passed that value as refernece, it will change. Apart from that I don't think there is any use of variable values as reference, they arenjust for record keeping and work is done in tasks and flow or script. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

 

 

 

Prataps135
Mega Sage

Hi @simran3,

var gr = new GlideRecord('sc_req_item'); // Change to your table
gr.addNotNullQuery('laptop_type'); // Ensure there's a value
gr.query();

while (gr.next()) {
    var refRecord = new GlideRecord('old_laptop_table'); // Change to your old referenced table
    if (refRecord.get(gr.laptop_type)) {
        gr.laptop_type = refRecord.getDisplayValue();
        gr.update();
    }
}

Please try this.

Thanks and Regards,
Pratap Singh Sisodia

Shivalika
Mega Sage

Hello @simran3 

 

Please confirm if you checked my answer. Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for my efforts and also it can move from unsolved bucket to solved bucket. 

 

Regards, 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeE