- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunday
I have a report on a Platform Analytics dashboard to list all SCTASKS assigned to groups the logged in user is a member of.
- Data Source: Catalog Task
- Custom Conditions
- Active = true
- Assignment group is (dynamic) 'One of My Groups'
This choice of dynamic filter unfortunately includes parent assignment groups which (in most cases) the user is not directly assigned to. I do not want to include the parent unless they are directly a member of it.
What I've tried so far:
- Dynamic Filter Option with Custom Script.
Result: Fails due to sandbox restrictions — Illegal use of while loop and Invalid function definition.
Even single-line or callback versions trigger sandbox policy violations in the current Yokohama release. - Script Include + Dynamic Filter
Created a Script Include to query sys_user_grmember and return a list of group sys_ids, then called it from the dynamic filter.
Result: Script runs fine in Background Scripts (returns valid sys_ids) but returns zero results in the report.
I've tried creating a couple of other test Dynamic Filters by have not succeeded. Am I over complicating the method to get this working?
Any suggestions would be appreciated on how to get this working the way I need it.
Instance: Yokohama Patch 6 Hotfix 2
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunday
So you can use GlideRecord and fetch the correct records to which the logged in user belongs w.r.t. group by querying sys_user_grmember and then query sc_task
Example: it worked fine for me. Please enhance it from your team
Output: I passed 2 sysIds from script include and Report shows 2 records correctly
💡 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunday
Please try using below logic
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunday
I believe Dynamic filter doesn't work in report filter condition.
Did you try to check if script include can be called there?
Something like this
-> script include is client callable
-> script include is class less
💡 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunday
So you can use GlideRecord and fetch the correct records to which the logged in user belongs w.r.t. group by querying sys_user_grmember and then query sc_task
Example: it worked fine for me. Please enhance it from your team
Output: I passed 2 sysIds from script include and Report shows 2 records correctly
💡 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
Thank you for your response, I have created a script includes, then changed the filter to Assignment Group> SysID is one of javascript:getGroupsReport().
This has removed the parent assignment group from the results.