How can I set the fields (like requested_for, opened_by) of sc_request and sc_req_item when I am calling the service catalog rest API explorer.

ravigupta
Mega Contributor

I want to call the install the software catalog using Rest API.  I tried to call the Buy Item (Post) method of Service catalog API. Which is able to create the ticket and set the variables values.

My Question is:

1. How can I set the fields (requested_for, opened_by) value of sc_request/sc_req_item using this API?

2. I am able to set the values of variables but how can I set the values in variable set.

I have attached the screen shot for your reference.

Thank you.

Ravi Gupta

2 REPLIES 2

Deepak Ingale1
Mega Sage

Setting up the values of variables in variable set is same as setting up for variables without variable sets

For field setting ,  I dont think that is possible via API provided in the screenshot

 

I would have created another variable and mapped that variable to field on sc_request table using before insert business rule

 

Another thing, custom scripted REST API will also be an option where we can write our own code to set those things up

 

https://community.servicenow.com/community?id=community_question&sys_id=6de843a1db5cdbc01dcaf3231f9619a9

rahulpandey
Kilo Sage
Hi, Create a scripted rest API and use cart APIs to create request. Create functions which accepts email ids as parameter and returns the user sys_id. In cart APIs, don't set the value which you recieved from rest call but parse it in service now format(sysids) using your functions. Try passing the email ids of users.