Change order of choices taken from table reference - CSM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2024 11:42 PM
I have a variable of type 'List Collector', type specification is taken from country table. I want to show a particular country as the first option in the drop down list. Is it possible. Please help.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2024 12:14 AM
You could try with an advanced reference qualifier and use a script like below. Not sure what it will do to performance though:
(function() {
var query = "name!=United States^ORDERBYname"; // This query excludes 'United States' and orders the rest alphabetically by name.
var countries = new GlideRecord('sys_country'); // Assuming 'sys_country' is the name of the country table.
countries.addEncodedQuery(query);
countries.query();
var result = "name=United States"; // Start with 'United States' at the top.
while (countries.next()) {
result += "^ORname=" + countries.name; // Append other countries ordered by name.
}
return result;
})();
I took 'United States' as an example and I have difficulty waking up my PDI, so not sure if it works.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark