Populated the location based on country
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
I have two variables 1. Impacted Country 2. Impacted Location and both are reference variables to cmn_location table
Requirement is if user picks country based on country locations should shown to users to select, until user selects the country locations should not return any records .if user remove the selected location country should also removed and refreshed and vice versa.
Can anyone help me with this requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
Hi @Shaik Najma ,
you can add a reference qualifier on the impacted location variable
and create a onChange client script on the impacted country variable
Note: replace the impacted_country and impacted_location with actual names of your variable
still having issue
please share the variable screenshots along with their type specifications information
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
what's the point in 2 variables both pointing to same cmn_location table?
Example: If I select Australia it's a location only but just that it has different states and each of those are different locations
I believe you should 1st discuss with customer what they actually want
š” If my response helped, please mark it as correct ā and close the thread šā this helps future readers find the solution faster! š
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello @Shaik Najma ,
I tried your use case , for that i have created following script include
var PopulateLocation = Class.create();
PopulateLocation.prototype = {
initialize: function() {},
getLoc: function(id) {
var arr = [];
var country;
var ga = new GlideRecord('cmn_location')
if (ga.get(id)) {
country = ga.country.toString();
}
var gr = new GlideRecord("cmn_location");
gr.addQuery('country', country);
gr.query();
while (gr.next()) {
arr.push(gr.sys_id.toString());
}
var data = arr.join(',')
return 'sys_idIN' + data;
},
type: 'PopulateLocation'
};Above script include is called in Location field reference qualifier
type:advanced
Reference qualifier :javascript:new PopulateLocation().getLoc(current.variables.country);
To see country in country variable :
If this helps you then mark it as helpful and accept as solution.
Regards,
Aditya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
