retrieve and display product owner name from the business app that was selected on catalog form

Bret Smith
Giga Guru

business_app is variable selected on form

 

name to display on form

BretSmith_5-1725662730990.png

lookup it_application_owner name from cmdb_ci_business_app table 

 

javascript: new RequestUtils().getAvailableBusinessApp(current.variables.business_app);

 

BretSmith_7-1725663336551.png

 

This is where I need help with the script include

 

extract from  'RequestUtils' script include

 

    getAvailableBusinessApp: function (businessappSysID) {
    // Get business app  object
    var retire_businessapp = new GlideRecord('cmdb_ci_business_app');
    retire_businessapp.get(businessappSysID);
    var OITTechnicalName = retire_businessapp.getValue('it_application_owner');
    // Return reference qualifier string
        return 'sys_idIN' + OITTechnicalName + AvailableBusinessApp;
 

 

 
 
 

 

 

 

 

2 REPLIES 2

Bret Smith
Giga Guru

I am trying to retrieve the it application owner name from the business app table

Brad Bowman
Kilo Patron
Kilo Patron

The OIT Technical Owner variable should be a reference on the sys_user table since you want to populate this with a user sys_id.  A Reference qualifier filters the list of available choices.  In this case it sounds like you want to populate the variable with the one value from the field on the cmdb_ci_business_app table, and since this variable appears to be read only, it doesn't matter what the reference qualifier is as this only comes into play when a user is manually selecting a record from a list.  If you are on the Utah or later version, try using the Variable Auto-populate feature for the OIT Technical Owner variable, dependent on the Business application variable, dot-walking to the it_application_owner field.

BradBowman_0-1725667075855.png

If you are not yet on Utah or later, or this doesn't work in this scenario, an onChange Catalog Client Script when Business application changes is what you need.  You can use the controversial getReference

https://www.servicenow.com/community/developer-articles/servicenow-introduction-to-getreference-serv... 

or the more robust GlideAjax

https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet-updated/ta-p/2... 

both good tools to have in your belt