How do we get the display value of reference cells in the multi-row variable set? i.e instead of displaying the sys_id.

PD6
Tera Contributor

How do we get the display value of reference fields in the multi-row variable set? i.e instead of displaying the sys_id.

I tried getDisplayValue() but it is giving as undefined.

 

8 REPLIES 8

It's not in the api documentation based on a hasty search, but it is not a protected script include - global.VariableUtil is fully readable.

But if it isn't documented, then ServiceNow does not consider it best practice to use the API because they can change or discontinue undocumented APIs in general without notice

Note:
The publication of this list does not imply that these scriptable objects are for use by
customers, consultants, and partners. The use of the Glide prefix does not imply that these
scriptable objects are in the same category as or have the same status as objects such as
GlideRecord. Except where documentation is provided in the API Reference, these
undocumented APIs are not intended for general use, and ServiceNow, Inc., does not make
any commitment to document them, answer questions about them, or maintain them indefinitely
in their current form. Over time, ServiceNow, Inc., intends to migrate a subset of the
functionality represented by these objects into the documented API and remove the rest.

https://www.servicenow.com/docs/r/xanadu/api-reference/scripts/c_PackagesCallRemovalTool.html?conten...

 

jd3737
Tera Contributor

Is there a way to do this without scripting?  I'm trying to build a report to show the values in the mrvs and for the reference fields, it's showing the sys_id instead of the display value.  My SNow setup is controlled by a central office and I don't have access to any server side functions, such as script includes, email notifications and the like.  Is there a no-code way to show the display values in a report?

Jesse_H
Mega Sage

Did you end up having any success with this?

 

I also had issues with reference fields in a multi-row variable set since it would only return the sys_id. I finally realized I could switch the variable to a Lookup Select Box, pick the table, and select specifically which field I wanted for the value and which field I wanted for the display. You also update the variable attribute so they can still search by adding 'is_searchable_choice=true'   and check the box to enable the -- none -- option by default.

....If you had some conditions on your reference variable, switch the reference qualifier to advanced real quick and copy the code. You'll put that under the ref_qualifier field when you switch it to a lookup select box.

I got part of the idea from the solution provided to this question: https://www.servicenow.com/community/developer-forum/display-3-variables-value-in-lookup-select-box-...

 

Here's an example variable:

Jesse_H_0-1731020120261.png