How to call script include in a module url argument to get dynamic delegated users?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 08:30 PM
Dear experts,
I have created a script include which is DelegationUtil, which helps to check is the user a delegate of the owner. And I want to create a module list view for them, and this is how defined the URL arguments but currently is not working. How can I approach this issue?
/sn_compliance_control_list.do?sysparm_fixed_query=owner=javascript:gs.getUserID(),(new global.DelegationUtil().isUserOrDelegate(current.owner))^state=draft,review^u_testing_procedureISNOTEMPTY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 09:03 PM
Hi @ChuanYanF ,
It looks like you're trying to create a filtered list view in ServiceNow using a custom script include (DelegationUtil) to determine if the current user is either the owner or a delegate. However, the issue lies in how you're trying to use JavaScript directly in the URL query, which ServiceNow does not support in that context.
Create a Dynamic Filter Option
You can create a dynamic filter option like "My Delegated Controls" and use your DelegationUtil logic in the script for that filter and call this filter directly from your module.
Mark this as helpful and correct if this helps.
Thanks,
yaswanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 09:24 PM
you can check lot of OOTB modules where script include is called and uses URL from arguments
Did you check those?
what does your script include function return?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 09:28 PM
you can also use List of Records Link type and use script include
See this OOTB module for "My Approvals"
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 10:30 PM
I tried using the same approach calling my script include like this below, Owner is javascript: global.DelegationUtil().isUserOrDelegate(), but it still does not work, Owner = (empty)