- 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
hello,
The user-name is also a unique field so you can directly pass the user_name instead of sys_id it will work like below:-
{"sysparm_quantity":"1","variables":{"description":"TESTING REST API EXPLORER","requestor_information":"true","requested_for":"abel.tuter"}}
Please mark my answer as correct based on Impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 12:38 AM
I tried this method but the variable becomes empty after the record is created.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 01:00 AM
I see I think there are two ways from here if you want to keep it a reference field then you will need to create a scripted rest API which gives you the ability to glide and populate the variable
If you don't want to create a scripted rest API then change the reference field to lookup select box and keep the lookup field to username and then send the username that should work i believe.
Please mark my answer as correct based on Impact
- 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.