Reference qualifier for lookup select box in servicenow

abhijee
Tera Contributor

Hello Experts, I have two lookup select box fields in Catalog Item. First one is Country and another one is State. So when I select a country in Country field, then only states of that country should populate in State field using 'cmn_location' table data. To achieve this I have created one Script Include and called it in Reference Qualifier.

 

When I test this Script Include in Background Script, I'm getting only states of that country returned.

 

But when I call it in State lookup field using Reference Qualifier, I'm still getting all states populated..

And I have attached screenshot for reference.

 

SS1 :- Variables

SS2 :- Script Include

SS3 :- Calling Script Include using Reference Qualifier

 

 

Thank You !!

8 REPLIES 8

vishakhayadav24
Tera Guru

Hi @abhijee ,

 

you can try the below code .

 

         var filterStr = '';
        while (gr.next()) {
            pArray.push(gr.state.toString());
        }
        filterStr = 'sys_idIN' + pArray.toString();
        return filterStr;
    },
 
Thank you!!
Vishakha Yadav

thank you so much @vishakhayadav24 

 

Mark Manders
Tera Patron

I think the issue is in calling it, but that attachment isn't here. Can you share that one?