- 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,627 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 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-02-2018 07:54 AM
Thanks for pointing me in the right direction.
Documentation
https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/custom_web_services/concept/c_CustomWebServices.html
Solution
(function process(request, response) {
return gs.getUserID();
})(request, response);