- 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.
- 6,912 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();
- 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
- 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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2018 06:34 PM
That is correct