Catalog Variable populated by script shows SYS_ID on RITM

Andrew Bettcher
Kilo Sage

We have a Location variable with 4 possible choices on it (Select Box - It's actually a list of 4 countries). When a user makes a selection a client script calls a script include which matches that location with records on a cmn_location table which are then sent back with labels to populate another Select Box so the user can select which "building" they are making the request for.

 

For example, the top field informs the bottom fields (some fields removed from screenshot for security):

AndrewBettcher_0-1718195396222.png


The problem is that on the RITM view, the label isn't showing. Instead we only see the sys_id. Is there a way to make it show the label on RITM view?

9 REPLIES 9

@Andrew Bettcher Are you sure this is a Client callable script include? This looks like a server side script include as the client side script includes are extended from 

Object.extendsObject(AbstractAjaxProcessor, {
 
Please 

The client script calls an Ajax wrapper that, in turn calls this script. Here is the Ajax wrapper:

var AvMeetingPopulateLocationAjax = Class.create();
AvMeetingPopulateLocationAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    //Ajax wrapper for AvMeetingPopulateLocation().populateLocation();

    populateLocation: function() {
        //get Location

        var location = this.getParameter('sysparm_location');

        //call avMeetingPopulateLocation()

        var populateLocation = new AvMeetingPopulateLocation();
        var result = populateLocation.populateLocation(location);

		return result;
    },

    type: 'AvMeetingPopulateLocationAjax'
});

Sandeep Rajput
Tera Patron
Tera Patron

@Andrew Bettcher Please check if the Display attribute is set on the Name field of table being referenced in Building field.

Please refer to this documentation for more information https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/field-admini...

 

I think this is what you mean Sandeep:

AndrewBettcher_0-1718198392461.png

 

CezaryBasta
Tera Guru

@Andrew Bettcher so it's working in the service portal, on the form, but doesn't work on the platform, on the RITM record?

Also, could you check the sys_id being displayed, are they the same that you have in your script include, as the cmn_location sys_id?

Have you tried console logging the responseArray in client script?

Also, in this.offices object you seem to have a trailing comma, which should not be there - after the last key/value pair.

--
See more of my content here.