How to use postman to create a Request, that then follows a workflow.

Patrick Delaney
Kilo Contributor

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

3 REPLIES 3

Prateek kumar
Mega Sage

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

dvp
Mega Sage
Mega Sage

Yes can use Service Catalog API in REST API explorer 

find_real_file.png

Here is the sample format of passing variables

{
	'sysparm_quantity':1,
	'variables':
	{
		'var_app_access': 'Jira',
		'var_cmdb':'a9c0c8d2c6112276018f7705562f9cb0'
	}
}

LaurentChicoine
Tera Guru

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.