Technical Articles
Testing workflow start UI in SAP Business Application Studio
Introduction
One of the usage patterns of SAP Build Process Automation is to utilize a custom UI5 application for initiating workflows. In this scenario you can create a UI5 application in SAP Business Application Studio (BAS) using “Workflow UI” > “Start UI” template.
However, attempting to test the app from BAS may lead to 404 errors, indicating that the route to workflow API has not been resolved.
Error testing from BAS
In this blog post, I will share how to test workflow start UI from SAP Business Application studio.
Prerequisite
- A process have been created in SAP Build Process Automation
Settings
Please follow below steps to enable testing in BAS.
- Create destination
- Configure ui5.yaml
Create Destination
This destination is only for testing within BAS. Once the application is deployed, the SAP Build Process Automation “service” will be used to call the API, as seen in the xs-app.json configuration below.
{
"welcomeFile": "/index.html",
"authenticationMethod": "route",
"routes": [
{
"source": "^/bpmworkflowruntime/(.*)$",
"target": "/public/workflow/rest/$1",
"service": "com.sap.spa.processautomation",
"endpoint": "api",
"authenticationType": "xsuaa"
},
First, create a service instance of SAP Build Process Automation with the “standard” plan and generate a service key for it.
Service instance
Next, proceed to create a destination using credentials from the service key.
Workflow destination
Property | Value |
---|---|
Name | Destination Name (Any) |
Type | HTTP |
URL | “endpoints.api” in the service key |
Proxy Type | Internet |
Client ID | “uaa.clientid” in the service key |
Client Secret | “uaa.clientsecret” in the service key |
Token Service URL | “uaa.url” int the service key + /oautn/token |
HTML5.DynamicDestination | true |
WebIDEEnabled | true |
Important: the properties “HTML5.DynamicDestination” and “WebIDEEnabled” are required to make BAS aware of the destination.
Configure ui5.yaml
Add the following setting to ui5.yaml.
backend:
- path: /bpmworkflowruntime
pathPrefix: /public/workflow/rest
url: https://spa-api-gateway-bpi-us-prod.cfapps.us10.hana.ondemand.com
destination: workflowruntime #your destination name
The complete content will look like the picture below.
ui5.yaml
Result
As a result, the invocation of the workflow API becomes successful. Interestingly, although fetching xsrf-token failed, the actual POST request was successful.
Successful testing from BAS
Final Words
While the start UI can be tested in BAS using the provided settings, I haven’t found a way to locally test task UIs. To the best of my knowledge, task UIs can solely be tested from My Inbox app. If anyone has insights on how to test them within BAS, kindly share your knowledge. In the meantime, I will explore potential solutions.
Hi Mio Yasutake,
I am a little confused by this post which refers to "SAP Process Automation". As far as I am aware, SAP Build Process Automation does not currently support custom ui5 start UIs. This is a planned feature on the roadmap.
Are you referring to the old SAP Workflow Management service?
Regards,
Mustafa.
Hi Mustafa Bensan,
Thanks for your comment. "SAP Process Automation" means "SAP Build Process Automation", and not SAP Workflow Management service.
In the scenario described in this post, a very simple process was created with SAP Build Process Automation. This process is triggered via API, from the start UI created in BAS.
Regards,
Mio
Hi Mio Yasutake,
The Start UI documentation you have referenced: “Workflow UI” > “Start UI”, is only applicable to the SAP Workflow Management service and not SAP Build Process Automation. That is why I have found your post a little confusing. In SAP Build Process Automation, custom start UIs cannot be embedded directly as the UI of a user task in the workflow definition. This is a future planned feature on the roadmap.
Regards,
Mustafa.
Hi Mustafa Bensan,
Indeed, Workflow UI > Start UI template was originally created for SAP Workflow Management service. But now if you choose this template, the default target is SAP Build Process Automation, as you would see in xs-app.json. Although we cannot embed custom UIs directly into processes, we can call them from outside using API.
As for the question about how to locally test task UIs or testing them from BAS, this is not currently possible in SAP Build Process Automation because task UIs cannot be developed in BAS, only in the SBPA form editor, hence they can only be tested live from the My Inbox app.
Regards,
Mustafa.
Hi Mustafa Bensan,
There are two options for developing workflow (process) with SAP Build Process Automation. One is to use the process editor inside SAP Build Process Automation. With this option, as you pointed, there is currently no way to embed custom task UIs. The second option is to use BAS for developing workflows and deploy them to SAP Build Process Automation. This is the same process we took with SAP Workflow Management service, thus custom task UIs can be used.
This blog post explains differences between these options.
https://blogs.sap.com/2023/07/19/migrating-from-workflow-management-to-sap-build-process-automation/
Hi Mio Yasutake,
I think it's important to clarify that the second option of using BAS for developing workflows is really intended to facilitate a transition/migration of existing workflows from SAP Workflow Management to SAP Build Process Automation. While it may be technically possible to continue creating new workflows in BAS and deploying them to SAP Build Process Automation, for future-proofing and to take advantage of new features, any new workflows for SAP Build Process Automation should be developed in the process builder and not BAS.
Regards,
Mustafa.