How to apply reference Qualifier for Lookup select box field in Catalog item

Siddalingesh200
Giga 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 !!

1 REPLY 1

Sheldon  Swift
ServiceNow Employee
ServiceNow Employee

Hi @Siddalingesh200 - You don't really need the script include, you can achieve the same with an advanced reference qualifier. You would just need to add conditions to make sure you're not picking up lower-level location types. For example, depending on your data structure, a state's parent may be the country.

 

 

javascript:if (current.variables.country != "") "country=" + current.variables.country

 

Note: The code sample encodes the colon, so make sure you replace ":" with ":"