Using 2 variables in Reference Qualifier for a list collector variable

Josh Evans
Tera Contributor

Hello

 

I am trying to use 2 other list collector variables in order to filter down a 3rd list collector. I am having trouble building the reference qualifier needed to filter down the 3rd collector. 

JoshEvans_0-1719947846835.png

Here is the current attempt at the reference qualifier. 

 

I have also tried to use a script include called by the reference qualifier.

JoshEvans_1-1719948108889.png

Here is the script include.

var NonGRCGetBusinessRoles = Class.create();
NonGRCGetBusinessRoles.prototype = {
initialize: function() {},

NonGRCBRoles: function (country,location)
{
    gs.addInfoMessage("function start");
        gs.log("Country "+ country);
        gs.log("Location " + location);
        gs.addInfoMessage("Country" + country);
        gs.addInfoMessage("Location" + location);
        var brolelist = [];
        var nongrcbroles = new GlideRecord('u_non_grc_brole');
        nongrcbroles.addQuery('countryIN'+country).addCondition('locationIN'+location);
        nongrcbroles.query();
        while (nongrcbroles.next())
        {
            brolelist.push(nongrcbroles.sys_id.toString());
        }
        return 'sys_inIN' + brolelist.join;

},

    type: 'NonGRCGetBusinessRoles'
};

I can get the function to be called, but it gets called before the country and location fields are filled in, so nothing gets filtered out. I am a little stumped.

 

Any assistance would be greatly appreciated.

 

Thank you in advance!

1 ACCEPTED SOLUTION

James Chun
Kilo Patron

Hi @Josh Evans,

 

Nothing seems out of the ordinary but I can see that you are referencing a custom table.

If so, are you certain the field names (location, country) are correct?

Should they be something like u_location and u_country instead?

 

If that doesn't work, try generating the query via copying a query from a list view -

https://docs.servicenow.com/bundle/washingtondc-platform-user-interface/page/use/using-lists/task/t_...

 

Cheers

View solution in original post

4 REPLIES 4

James Chun
Kilo Patron

Hi @Josh Evans,

 

Nothing seems out of the ordinary but I can see that you are referencing a custom table.

If so, are you certain the field names (location, country) are correct?

Should they be something like u_location and u_country instead?

 

If that doesn't work, try generating the query via copying a query from a list view -

https://docs.servicenow.com/bundle/washingtondc-platform-user-interface/page/use/using-lists/task/t_...

 

Cheers

Yup, that was exactly it, thank you James! Is there a way in the reference qualifier to account for multiple selections, would it be something like "countryIN" instead of "country="?

Yup, make sure you dot-walk to one of its attributes first.

 

e.g.

country.sys_idINsys_id1,sys_id2... OR

country.nameINname_1,name_2....

You are a lifesaver, thank you so much!