- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 04:43 AM
Hi there,
I am using gs.getUserId() in a condition for a UI action.
What does this method return, is it the sys_id of the user?
If so will this work if I assign the variable and then use it in /includes as below:
var user = gs.getUserID();
approvers.includes(user);
Will this return true or false or just break? and if it breaks can I use the following syntax:
gs.getUserID().toString();
Thank you
G
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 05:38 AM
yes it returns sysId as string so no need to use toString() function
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
01-29-2024 05:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 04:58 AM
gs.getUserID() returns sys_id of logged in user
what does approvers indicate here? I believe it should be an array
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 05:14 AM
Thanks for your response. Approvers is indeed an array and I need the sys_id to be in string format. Will gs.getUserID().toString(); work?
Kind regards,
G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 05:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 05:35 AM
Thank you for your response. I just need the sys_id but as a string. How would I about this?
Would gs.getUserID().toString(); work?
Kind regards,
G