- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2018 09:51 AM
Hi, Im using Authorization code grant flow (OAuth 2) to authenticate users and get them access to Service Now RESTful APIs. My question is, how do i get the user sys_id (similar to var currentUser = gs.getUser(); gs.info(currentUser.getID());) using the available RESTful APIs.
My current workaround is,POST to the incident table and get the sys_id from opened_by key
Solved! Go to Solution.
- 4,625 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2018 08:47 PM
If it is a scripted rest api, you can easily assign value to an attribute.
For example body.USER = gs.getUserID();
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2018 10:05 AM
You can use gs.getUserID() to get the sys id of the current user
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2018 10:15 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2018 12:33 PM
Can you elaborate more?
You are sending a rest api to ServiceNow? And you want to send response back with the sysid of the user using which you are sending the rest api?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2018 06:34 PM
That is correct