SysId needs to be converted to the Display Value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 12:59 AM
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:
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 01:13 AM
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