How to use postman to create a Request, that then follows a workflow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 11:24 AM
I am not a full fledged developer, probably more of a "citizen developer" .... I am working in our dev instance, and I am running out of sample data (RITMs). So I want to use Postman (or any other similar tool) to bulk create more RITMs.
I am able to create RITMs via the REST API, but they are not getting the associated catalog variables the they get when they are created via the workflow.
The ServiceNow team has created a form that the end-used fills out. The form is a request. when they submit it, it follows a workflow. (a very simple one) The workflow creates a RITM and 1 task associated with the RITM.
Can I use the REST api to create the Request and in the json specify what workflow to trigger?
Thanks
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 11:26 AM
You have to look at Service vcatalog API
https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/integrate/inbound-rest/concept/c_ServiceCatalogAPI.html
Please mark my response as correct and helpful if it helped solved your question.
-Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 11:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 11:40 AM
Hi Patrick, to create demo data, I would probably run a background script (fix script or even script execution module to be reusable) instead of postman. That way your remove the dependency on Postman and make it easier for anybody to create these demo requests.
Your script could look something like this:
var itemId = ''; //item sys_id you want to order
var quantity = 1; //quantity you want to order
var cart = new sn_sc.CartJS("cart_" + itemId);
var order = {
sysparm_quantity: quantity,
sysparm_cart_name: "cart_" + itemId,
variables:
{
'variable1': 'value'
}
};
cart.orderNow(order);
You could loop this script to order as many as you want.