- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 07:33 AM
Hi All,
We have a requirement to create catalog request using this REST API with the help of Service catalog API -/api/sn_sc/servicecatalog/items/{sys_id}/order_now , Here i am using BUY ITEM(POST) call.
Catalog is getting created successfully with below payload
{"sysparm_quantity":"1","variables":{"description":"TESTING REST API EXPLORER","requestor_information":"true","requested_for":"a3b4d485db499010bdcfd5ab5e961972"}}
But instead of 'sys_id' of 'requested_for', I want to pass user_name of the user. How we can achieve this.
Appreciate for the quick response. Thank You.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 03:01 AM
Thanks,. Service catalog API will only allow sys_id's for reference variables,
I have created the custom scripted REST API to achieve this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 07:54 AM
Hi @Mohan Mallapu ,
You need to use custom Scripted REST API, the ServiceCatalog API will not handle user_names.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 08:10 AM
First, query the User [sys_user] table using the Table API to find the appropriate user record by user_name and grab their sys_id. Then plug that sys_id into the second REST call using Service Catalog API to place an order in the name of the given user.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 08:16 AM
Hi @Mohan Mallapu ,
As mentioned by @Saurav11 , user_name (User Id) will work.
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates