on 06-27-2023 4:03 AM
Hi All,
We are implementing a CAP project, where we are triggering workflow and cancelling workflows from frontend UI. Following this approach we are facing few issues related to security. I believe we can do the same from backend CAP actions. Would appreciate if you can share details or code snippets on how to achieve this. Thanks...
Regards,
Phani.
Hi Phani,
You can interact with SAP Build Process Automation like any other external service in CAP.
You will need:
package.json:
"dependencies": {
"@sap-cloud-sdk/http-client": "^2.9.0"
},
"cds": {
"requires": {
"spa_api": {
"kind": "rest",
"credentials":{
"destination": "YourDestinationName"
}
}
}
}
service.js:
srv.on('YourAction', async (req) => {
const workflowContent = {
"definitionId": "eu10.abc.xyz",
"context": {
"param1": null,
"param2": null
}
};
const SPA_API = await cds.connect.to('spa_api');
const result = await SPA_API.send('POST', '/workflow/rest/v1/workflow-instances', JSON.stringify(workflowContent), { "Content-Type": "application/json" });
return result;
});
Using the SAP Build Process Automation REST APIs you can trigger any action on the workflow you want.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks willem.pardaens
your answer help me to configure destination for rest kind destination in CAP.
User | Count |
---|---|
67 | |
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.