Field is showing sys-id instead of value

Yi Ming Song
Tera Contributor

I have a custom table which has a Category column (u_category). In the service catalog form, the Category field is referenced from the u_category column. The service portal catalog form will show the label/text value of the Category.

 

But when the ticket is opened in the backend, the field is showing the sys_id instead of the value.

 

How to display the value instead of the sys_id?

Can I use a client script to overwrite the field with the data value of itself? And if so, what is the syntax for it?

1 ACCEPTED SOLUTION

jaheerhattiwale
Mega Sage
Mega Sage

@Yi Ming Song

Open referenced table

Open form

Right click on the field label (which field you want to see in reference field)

Set display to true

jaheerhattiwale_0-1673601000204.png

 

 

Please mark as correct answer if this solves your issue.

 

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

View solution in original post

3 REPLIES 3

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @Yi Ming Song ,

Make a use of .getDisplayvalue() where you are passing the sys_id as category field is reference field while setting it might be taking the sys_id

Please check the below article

 

getDisplayValue(fieldName)

Retrieve the display value for the specified field, if the user has permission to view that field's value.
Can only be called from the callback function after the query is complete.

 

 

Parameters

 

 

 

Name Type Required Description

fieldNameStringTrueThe name of the field to retrieve the display value for.

 

 

Example

 

//Get assignment groups for child Incidents for some reason
new EfficientGlideRecord('incident')
    .addQuery('parent', g_form.getUniqueValue())
    .addField('assignment_group', true) //Get display value as well
    .query(function (egrIncident) {
        var assignmentGroupNames = [];
        while (egrIncident.next()) {
            assignmentGroupNames.push(egrIncident.getDisplayValue('assignment_group'));
        }
        //todo: Do something with the assignment group names
    });

 

 

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

jaheerhattiwale
Mega Sage
Mega Sage

@Yi Ming Song

Open referenced table

Open form

Right click on the field label (which field you want to see in reference field)

Set display to true

jaheerhattiwale_0-1673601000204.png

 

 

Please mark as correct answer if this solves your issue.

 

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

Community Alums
Not applicable

Helpful
out of the box solution