My Dynamic Filter Option is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
I have written a Dynamic Filter Option as seen in the following image:
The function you can see in the script is defined in TMNReferenceQualifier script include as follows:
getMyAssetManagementDepartmentGroups: function() {
var myGroups = gs.getUser().getMyGroups();
var groupArray = [];
for (var i = 0; i < myGroups.size(); i++) {
var group = myGroups.get(i);
groupArray.push(group); // aquà ja tens el sys_id del grup
}
var groupQueryString = groupArray.join(',');
var resultArray = [];
var department = new GlideRecord('cmn_department');
department.addEncodedQuery('u_associated_groupIN' + groupQueryString);
department.query();
while(department.next()) {
resultArray.push(department.getValue('u_associated_group'));
}
return resultArray;
},
If I try this code in a Background Script it returns the correct sys_ids it should, but when I try to use it as a filter in the alm_asset table it shows in the breadcrumbs as (empty)
Can anybody see which error am I doing? I have looked at some others OOB DFOs but they seem to follow similar structures as mine.
Thanks for everything!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday - last edited Wednesday
Hi @jordimsant
May you try
script include.
getMyAssetManagementDepartmentGroups: function() {
var myGroups = gs.getUser().getMyGroups();
var groupArray = [];
for (var i = 0; i < myGroups.size(); i++) {
var group = myGroups.get(i);
groupArray.push(group); // group is already a sys_id
}
var groupQueryString = groupArray.join(',');
var resultArray = [];
var department = new GlideRecord('cmn_department');
department.addEncodedQuery('u_associated_groupIN' + groupQueryString);
department.query();
while (department.next()) {
resultArray.push(department.getValue('u_associated_group'));
}
// FIX: return as comma-separated string
return resultArray.join(',');
},
reference qualifier
javascript: new TMNReferenceQualifier().getMyAssetManagementDepartmentGroups()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
I have already tried this solution and it is not working