Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

SysId needs to be converted to the Display Value

dev_K
Tera Contributor

Hi All,

 

 

I have a catalog item that uses MRVS, i need a combo of 2 values from the form to populate a a field on the MVRS:

dev_K_0-1726559877443.png

 

 

Im using g_service_catalog.parent.getValue() and it works for the first value but second gives me the sysID of the value. How to get the display value instead?

1 REPLY 1

Badrinarayan
Tera Guru

Hi @dev_K , 

 

To convert a sys_id to its display value in ServiceNow, you can use the GlideRecord class or GlideAjax depending on whether you are working on the server-side or client-side.

Server-side (using GlideRecord)

If you're working on a server-side script (e.g., Business Rule, Script Include, etc.), you can retrieve the display value like this:

 

 

var gr = new GlideRecord('table_name');  // Replace with your table name
if (gr.get('sys_id', 'your_sys_id_value')) {
    var displayValue = gr.getDisplayValue();  // Get the display value of the record
    gs.info("Display Value: " + displayValue);
}

 

This will return the display value of the record that corresponds to the given sys_id.

 

Please Mark it as Helpful and Accept the Solution , If your Solution is Resolved

Thanks Regards 

Badrinarayan