How to set dependent filter in reference qualifier for state field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
How I can set filter condition to populate State(cmn_location) field value based on the country(core_country)field selection?
Regards,
Dusmanta Nayak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
If you are trying this on the variable side, you can make the dependent field state based on the country.
Reference Qualifier in Catalog item:
Script Include:
var FilterStates = Class.create();
FilterStates.prototype = {
getStatesByCountry: function(country) {
//You check if the country is empty. If it is you don't include it in the reference qualifier and return.
if (!country) return '';
var stateList = [];
var stateGr = new GlideRecord('your_state_table');
stateGr.addQuery('your_country_field', country);
stateGr.query();
while (stateGr.next()) {
stateList.push(stateGr.getUniqueValue());
}
return "sys_idIN" + stateList.join(',');
},
type: 'FilterStates'
};
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Dr Atul G- LNG ,
Script include is not working.
Can you please help and suggest that do i need to modify the script include?
Note: Both the fields type is "Lookup Selectbox".
Screenshot:
Reference Qualifier of State field:
Script Include:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In your reference qualifier check below two probable mistakes :
- Word "new" is written twice
- location spelling is incorrect. written as "loction". Check the variable configuration.
Accept the solution and mark as helpful if it does, to benefit future readers.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
- Right-click the State/Province field and select Configure Dictionary.
Go to the Dependent Field tab.
Check the Use dependent field box.
In the Dependent on field dropdown, select Country (country).
Save the record.
If this is useful please mark it as helpful and accept my solution....
