- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-12-2020 07:44 AM
Hello Community,
I have two variables in catalog item
1. Vendor - reference to core_company
2.locations - reference to cmn_location
So if i select company and it should be related locations in location reference
for example if select japan and it should be display only japan locations in locations reference variables
Can you please help me how to sort out this.
Thanks,
Nagesh klv
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-12-2020 01:00 PM
Hi,
You also need to add the following attribute
ref_qual_elements=vendor
Only then the selected vendor will be passed to the server and fetches the locations accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-12-2020 08:10 AM
Not sure what you want to do exactly? If you Select a Vendor that is in Japan, you want only locations that are in japan?
You can create a Script include as follows:
var getRecords = Class.create();
getRecords.prototype = {
initialize: function () {
},
getCountry: function (vendor) {
var gr = new GlideRecord('core_company');
if (gr.get(vendor)) {
return 'country=' + gr.getValue('country');
}
},
type: 'getRecords'
};
Then in the Reference qualifier of your Locations field use:
javascript: new getRecords().getCountry(current.variables.vendor_field);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-12-2020 08:18 AM
Updated the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-12-2020 09:32 AM
Sorry for the confusion
actually i want to display the locations based on company selection
if i select abc company i want display that company locationsv in location variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-12-2020 10:26 AM
In the locations field use the Advanced Reference qualifier:
Replace vendor_field with the name of your field that is referencing the company
javascript: 'company=' + current.variables.vendor_field;
You do not need the script include.