Using Advanced Reference Qualification in Catalog Variables

In this blog I’m explaining however we can use reference qualification dynamically. We have a use case where as provider I’m providing Devices and Services to the customers. Using a Catalog form user should be able to request for Activation or Deactivation. Basically forms remains same only difference that based on the request type I should be able to choose the device or service available to that particular company. We are maintaining the device or service assigned to Company in CMDB with appropriate status.

Request type Activate shows only one CI, since customer has only that device meeting the criteria.

When Request Type Deactivate the CI Names showing all the activated device or services.

Now let’s see how we can do it.

  1. Create a reference variable with advanced Reference qualifier query

javascript:new deviceFilter().getCIList(current.variables.company_name,current.variables.request_type);     

  1. Create a Script include to call the function.

var deviceFilter = Class.create();

deviceFilter.prototype = {

initialize: function() {



getCIList : function(affiliate,reqType) {

var list = [];

var ci   = new GlideRecord(‘cmdb_ci_computer’);


ci.addEncodedQuery(‘company=’ + affiliate + ‘^install_status=3^u_in_activation=false’);


ci.addEncodedQuery(‘company=’ + affiliate + ‘^install_status=1^u_in_deactivation=false’);





while ( {



return ‘sys_idIN’ + list.join(‘,’);


type: ‘deviceFilter’



Posted in Blogs, ServiceNow and tagged , , , , .