Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Reference Qualifier for Lookup Select Box Type variables.

MarkJhonB
Tera Contributor

Hi everyone,
I'm working on a catalog item that uses 2 variable set.
location(reference type) is from variable set 1.
device(Lookup Select Box type) is from variable set 2.

I wanted to filter the items on the device variable using the location from the variable set 1.
I directly applied the reference qualifier to the device variable using this.
location=current.variables.location.

It does not work as expected. The return of the location was blank since I think variable set 2 cannot directly access the value of location from the variable set 1. To access the value, both variable set 1 and 2 should be added under the catalog item. 

So, on the catalog item. I created a client script that will set a reference qualifier for the device variable.
This script below will only work if the variable is a reference type, but unfortunately it doesn't work on the Lookup Select Box type variable.

    g_form.clearValue('device');
    var queryfilter = g_list.get('device');
    queryfilter.reset();
    queryfilter.setQuery('location='+ g_form.getValue('location'));

Does anyone have an idea or encountered something like this?



1 ACCEPTED SOLUTION

Chaitanya ILCR
Mega Patron

Hi @MarkJhonB ,

 

update the ref qual and variable attributes as below

ChaitanyaILCR_0-1751370570019.png

ref qual(not replace : with 🙂 in the ref qual (refer screen shot)

javascript:'location='+current.variables.location;

variable attributes

ref_qual_elements=location

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

View solution in original post

3 REPLIES 3

Chaitanya ILCR
Mega Patron

Hi @MarkJhonB ,

 

update the ref qual and variable attributes as below

ChaitanyaILCR_0-1751370570019.png

ref qual(not replace : with 🙂 in the ref qual (refer screen shot)

javascript:'location='+current.variables.location;

variable attributes

ref_qual_elements=location

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Hi @Chaitanya ILCR ,
It does not work, as I mentioned above. I think it cannot retrieve the value from the location variable since the location is from a different variable set. They are not in the same variable set.

Disregard this reply; it's my fault for using a semicolon instead of a colon. It is working fine now.
Thank you so much @Chaitanya ILCR !