i,Dynamic filter with script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi,
Im trying to create a customize dynamic filter using script include that will show only groups that I belongs to without the parents group (the OOB One of my groups dynamic filter includes the parents group).
What am I doing wrong?
var getMyGroupsOnly = Class.create();
getMyGroupsOnly.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroups: function(userId) {
var cr = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user',userId);
gr.addQuery('group.active',true);
gr.query();
while(gr.next()){
var groupId = gr.getValue('group');
if(!gs.nil((groupId))){
cr.push(groupId);
}
}
return cr;
},
type: 'getMyGroupsOnly'
});
Result:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
@Ankur Bawiskar i got 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
then try searching in wm_task with those 4 group sysIds?
any query BR on wm_task is stopping you from seeing those records
do like this and give 4 sysIds of groups
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
@Ankur Bawiskar it seems like the problem is that i cant call the script include from the dynamic filter correctly for some reason.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
@Ankur Bawiskar any suggestion what could be the reason?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
try creating classless script include with some other name
💡 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