- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2022 09:15 PM
Hello Experts,
I feel strange when I'm using Glide system API method gs.getUserID in script include, it just returns 'system' instead of the sys_id of the current user. And also other methods related all return 'system'. Do you know the reason for it?
Thanks & Regards
Amber
Solved! Go to Solution.
- Labels:
-
compliance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2022 09:53 PM
Amber,
Can it be that Script Include is being executed from email? gs.getuserID() will return sys_id of the currently executing user. In case of email or scheduled jobs, this can be "system".
See simiilar question in the following thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2022 09:22 PM
Hi,
in whose session the script is running and where it is written?
please provide some more details and screenshots for that
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2022 11:08 PM
It is written in a script include which is called from a flow action.
Here is where I used:
roleHas.addQuery('user', gs.getUserID());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2022 11:19 PM
Hi,
Flow is configured to Run as System or User session?
share flow properties screenshot
Share details as Flow is running on which table? in which step you are using the query/script?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2022 09:41 PM
Hi Amber,
Try running the script from Scripts Background.
gs.info(gs.getUserID());