- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2022 01:56 PM
Using the /order_now functionality of the REST API I can create an REQ. In order to set the Requested For, I have to know the sys_id of the user. Is there any way to use the email or User ID and set the Requested For via the REST API?
I'm sure I'm missing something as this seems rather limiting for other applications to have to have the sys id in order to integrate with ServiceNow.
thanks,
lee
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2022 06:18 PM
There are2 ways to do it.
1. Scripted REST API in Servicenow where you will get requested for as a string and then glide record the sys_user table to get the sys id of that user and use that when creating the REQ.
2. You can write down a before business rule that runs on insert on REQ table and in conditions put your integration user so this will not be applicable for other users and then glide record the sys_user table to get the sys id of that user and update current.requestedfor.
Please let me know in case you need help with scripts.
Please mark correct and helpful if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2022 06:18 PM
There are2 ways to do it.
1. Scripted REST API in Servicenow where you will get requested for as a string and then glide record the sys_user table to get the sys id of that user and use that when creating the REQ.
2. You can write down a before business rule that runs on insert on REQ table and in conditions put your integration user so this will not be applicable for other users and then glide record the sys_user table to get the sys id of that user and update current.requestedfor.
Please let me know in case you need help with scripts.
Please mark correct and helpful if this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2022 06:36 PM
Hi Lee,
Unless creating a Scripted REST API, it's necessary to get the user's sys_id using REST Table API. That is, it's necessary to make several API calls.
https://<instance name>.service-now.com/api/now/table/sys_user?sysparm_query=user_name%3D<user id>&sysparm_limit=1
https://developer.servicenow.com/dev.do#!/reference/api/rome/rest/c_TableAPI