The CreatorCon Call for Content is officially open! Get started here.

Starting a workflow through REST

kari2
Kilo Explorer

Hello -

I am creating a RITM record through REST. I am setting the Item to the appropriate catalog item, which should trigger a workflow, but the workflow never is kicked-off. Is it possible to kick-off a workflow for a RITM through a REST message?

3 REPLIES 3

larstange
Mega Sage

Hi



Its the business rule "Start Workflow" in the sc_req_item table which actually starts the workflow. This happens after the requested item is updated and stage=='request_approved'



So if you don't use tthe standard way of creating a requested item via a script, then you need to update the requested item record after insert and set the stage field



Official way: http://wiki.servicenow.com/index.php?title=Order_a_Service_Catalog_Item_from_a_Script#gsc.tab=0


Chuck Tomasi
Tera Patron

Hi Kari,



Are you using the Service Catalog REST API? Use the REST API Explorer to test.



Once the item is in the cart and the order submitted, the workflow associated with the item should engage automatically.



find_real_file.png


larstange
Mega Sage

Yes if you use the Service Catalog API there is an order_now method. If you use this the workflow should be activated



POST https://{instance].service-now.com/api/sn_sc/servicecatalog/items/{sys_id}/order_now



https://developer.servicenow.com/app.do#!/rest_api_doc?v=helsinki&id=c_ServiceCatalogAPI



The documentation does not describe the order_now method, but it should work the same way as the checkout_guide method