Reference qualifier for lookup select box in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2024 11:26 PM
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 !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2024 10:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2024 02:22 AM
Hello @Mark Wood ,
Instead of taking array take a string and store the sys_id of the states in it with comma separated values,
And while return from script include use the following syntax :
Script include should be client callable and after that select the role also to run that script for.
And the syntax of the reference qualifier should be :
javascript: new scriptIncludeName().functionName(passed value that you want to use in script include.);
If your problem solve with above solution please mark my answer as helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2024 02:29 AM
Hi @Mark Wood,
You may try with the following solution.
In reference qualifier instead of calling script you can directly write the
javascript:"country="+current.variables.enter_country; //here "enter_country" is backend name of my country lookup box.
Please mark my response as correct and helpful if it helped solved your question.
Thanks,
Rohit Suryawanshi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2024 01:38 AM
Hi @Mark Wood
Assuming you have two lookup select box variables for Country and State respectively, you need to make use of the below Advanced Reference Qualifier in the State field to populate State based on country :
javascript:"country="+current.variables.country.getDisplayValue(); //Assuming country is the name of the Country variable.
Output :
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.