- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 07:44 AM - edited ‎12-07-2023 07:48 AM
Hello
I have the Location variable, referring to 'cmn_location', and also have a Related list on 'cmn_location' that is Cost Center and referring to 'u_m2m_cmn_location_cmn_costcntr'.
On Selection of Location, that filters the cost center and shows the record in to Cost Center variable.
Please refer below Script include and reference qualifier using on 'Cost Center' variable
RQ:
javascript: new PopulateCostCenter().getCost(current.variables.location);
SI:
Client Callable
getCost: function() {
var costcenterlist = [];
var locationIs = new GlideRecord('cmn_location');
locationIs.addQuery('sys_id',current.sys_id);
locationIs.query();
if (locationIs.next()) {
var costIs = new GlideRecord('u_m2m_cmn_location_cmn_costcntr');
costIs.addQuery('u_location', locationIs.sys_id);
costIs.query();
while (costIs.next()) {
costcenterlist.push(costIs.getUniqueValue());
}
}
return 'sys_idIN' + costcenterlist;
},
And it's working fine in background script:
But, its is not filtering the records.
Any assistance in resolving the issue would be greatly appreciated.
Thanks and Regards
Kartik Magadum
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 10:37 AM
Hello all
Done with requirement and without script include, I have added a below line in RQ for cost center
javascript:"u_location=" + current.variables.location
Refer attached doc: Reference qualifier
Note: No space before : and after :
Thank You

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 08:08 AM - edited ‎12-07-2023 08:09 AM
In your script include getCost method you have no parameter setup. You are passing current.variables.location into the script include, but you need to specify the parameter in the method declaration.
getCost: function(location) {
var costcenterlist = [];
var locationIs = new GlideRecord('cmn_location');
locationIs.addQuery('sys_id', location;
locationIs.query();
if (locationIs.next()) {
var costIs = new GlideRecord('u_m2m_cmn_location_cmn_costcntr');
costIs.addQuery('u_location', locationIs.sys_id);
costIs.query();
while (costIs.next()) {
costcenterlist.push(costIs.getUniqueValue());
}
}
return 'sys_idIN' + costcenterlist;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 09:21 AM
Thank You, but still not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 10:37 AM
Hello all
Done with requirement and without script include, I have added a below line in RQ for cost center
javascript:"u_location=" + current.variables.location
Refer attached doc: Reference qualifier
Note: No space before : and after :
Thank You