cancel
Showing results for 
Search instead for 
Did you mean: 

Starting workflow instance from CAP service

js2
Product and Topic Expert
Product and Topic Expert

I'm wondering if its possible (and if any examples exist) for starting a CF workflow instance from a CAP application?

I can see examples (and the open sap cap course - week 4) cover calling external services but these are always OData services with an edmx file that can be used with the `cds import` command.

(According to `cds help import`: "Currently only OData EDMX input is supported".)

The workflow APIs (https://api.sap.com/api/SAP_CP_Workflow_CF/overview?name=SAP_CP_Workflow_CF&type=JSON∾tion=download&artifactType=REST) are REST API's only (not OData).

Alternative options would be to code the rest call directly in the UI5 app (though architecturally it seems better to do this from the cap service) or to fire an enterprise messaging event (which my cap service is doing anyway) and using CPI to capture that event and call the workflow api.

js2
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thankyou david.kunz2 and pdominique-bio. Will investigate this method. The fact that cds import states it only works with edmx files had me thinking I could only work with OData.

View Entire Topic
pierre_dominique2
Contributor

Hi Jason,

Yes you can implement custom handlers to achieve this. There's also a library to help with that: https://github.com/sapmentors/cds-scp-api

Pierre