Enabling external workflow for Features in SAP Cloud ALM

Estimated read time 11 min read

We are thrilled to introduce the integration of external workflow for Features in SAP Cloud ALM! It is our newest Change and Deployment Management functionality designed to add custom approval and confirmation steps to the default Feature workflow.

With Feature workflow integration, you can automatically trigger a custom workflow when a Feature’s status changes to ‘Successfully Tested”. Custom workflows can be created using external workflow tools, such as SAP Build Process Automation.

In the following example, we will show how to design a custom test confirmation workflow in SAP Build Process Automation (BPA) and enable it for Features in SAP Cloud ALM. When the user triggers the action “Confirm Successful Test” in a Feature, the workflow is automatically started in the BPA instance. A test confirmation request will be sent to the inbox of the dedicated approver. If the request is approved, the Feature status will be set to “Successfully Tested”. In case the request is rejected,  the Feature status will stay “In Testing”.

Configuration Prerequisites

SAP Build Process Automation subscription and the corresponding service instance (including service key) are available.

For more information, please see: https://help.sap.com/docs/build-process-automation/sap-build-process-automation/subscribe-to-sap-build-process-automation

SAP Cloud ALM has been provisioned and a Cloud ALM API service instance has been created (including service key)

For more information on how to create a Cloud ALM API service instance, please see: Enabling SAP Cloud ALM API 

Configuration Overview

Create destination from SAP Cloud ALM to SAP Build Process AutomationCreate destination from SAP Build Process Automation to SAP Cloud ALMDefine workflow in SAP Build Process AutomationCreate workflow subscription in SAP Cloud ALMAssign the workflow subscription to a project in SAP Cloud ALM

Create destination from SAP Cloud ALM to SAP Build Process Automation

Logon to your SAP Business Technology Platform (BTP) subaccount where your SAP Cloud ALM tenant is provisioned. Navigate to the section Connectivity -> Destinations and create a destination with the following parameter:

Parameter Name ValueType HTTPURL https://<url>/workflow/rest/v1/workflow-instances
<url> = URL from the section endpoints -> api of the BPA instance service keyProxy Type InternetAuthentication OAuth2ClientCredentialsClient ID section uaa->clientid of the BPA instance service keyClient Secret section uaa->clientsecret of the BPA instance service keyToken Service URL TypededicatedToken Service URLhttps://<tenant>.authentication.<domain>.hana.ondemand.com/oauth/token
for <tenant> and <domain>, please refer to the URL from the section uaa->url of the BPA instance service key

 Create destination from SAP Build Process Automation to SAP Cloud ALM

Logon to your SAP Business Technology Platform (BTP) subaccount where your SAP Build Process Automation tenant is provisioned. Navigate to the section Connectivity -> Destinations and create a destination with the following parameter:

Parameter Name ValueType HTTPURL https://<your tenant>/apiProxy Type InternetAuthentication OAuth2ClientCredentialsClient ID section uaa->clientid of the Cloud ALM API instance service keyClient Secret section uaa->clientsecret of the Cloud ALM API instance service keyToken Service URL TypededicatedToken Service URLhttps://<tenant>.authentication.<domain>.hana.ondemand.com/oauth/token
for <tenant> and <domain>, please refer to the URL from the section uaa->url of the Cloud ALM API instance service key

Add the following additional properties to the destination:

sap.applicationdevelopment.actions.enabled = truesap.processautomation.enabled = true

Define workflow in SAP Build Process Automation

Here is an example of a test confirmation workflow including a 4-eyes principle check and email notification to the test approvers:

You can download the example workflow HERE, import it into your SAP Build Process Automation tenant and adjust it to your needs.

Note, that the Feature status switch is done by using the Workflow API. When a workflow is accepted (workflow status COMPLETED), the Feature status will be set to “Successfully Tested”. In case a workflow is rejected (workflow status FAILED), the Feature status will remain “In Testing”. By using script tasks you can access the contextual information of the workflow and maintain optional attributes like externalApprovers or externalDecision which are maintained in the Feature history when a workflow is executed.

For more information about script tasks, please check the following: https://help.sap.com/docs/workflow-capability/workflow-cloud-foundry/accessing-contextual-information-during-execution-of-script-tasks 

Please ensure that you have created an environment variable of type Destination under the project properties of your workflow project:

At the project deployment you will be asked to map the Cloud ALM API destination (from SAP Build Process Automation to Cloud ALM) to the destination variable:

Create workflow subscription in SAP Cloud ALM

Create a webhook in External API Management

Logon to your SAP Cloud ALM tenant and navigate to External API Management:

Go to Webhooks Management and choose “Add new webhook”:

Enter the following data:

Parameter Name ValueName<name of the webhook>Ext Resource TypeWorkflowDestination SourceBTP destinationDestination Id <id of the destination from SAP Cloud ALM to Build Process Automation tenant>Destination Type Other

Create mapping

Go to Mappings Management and choose “Add new mapping”:

Enter the following data:

Parameter Name ValueDescription<name of the mapping>Version1.0SourceSAP Cloud ALMDestination SAP Build Process AutomationMapping TypePayload Based

Download the example mapping HERE and use it to define the mapping rules.

For more information about mandatory and optional mapping, please check the corresponding sections of the Feature Workflow API guide: https://help.sap.com/docs/cloud-alm/apis/configuration-steps-for-workflow-api-for-features 

Add a subscription in External API Management

Go to Subscriptions Management and choose “Add new subscription”.

Enter the following data:

Parameter Name ValueName<name of the subscription>Description<description of the subscription>TypeBuilt-inResource TypeWorkflowWebhook <name of the webhook you created before>Mapping <name of the mapping you created before>User Variable NameworkflowDefinitionIdUser Variable Value<workflow id>

To get the workflow ID, logon to your SAP Build Process Automation tenant, navigate to Control Tower and go to the tile Environments. Choose the environment where you deployed your workflow. Go to Processes and Workflows, choose your workflow and copy the ID:

This is how the example subscription looks like:

Assign the workflow subscription to a project in SAP Cloud ALM

Navigate to a project for which you want to use the Feature workflow and go to the Subscriptions tab. Assign the already created workflow subscription to the Feature entity:

You are now able to execute test confirmations for Features in SAP Cloud ALM by using SAP Build Process Automation.

 

​ We are thrilled to introduce the integration of external workflow for Features in SAP Cloud ALM! It is our newest Change and Deployment Management functionality designed to add custom approval and confirmation steps to the default Feature workflow.With Feature workflow integration, you can automatically trigger a custom workflow when a Feature’s status changes to ‘Successfully Tested”. Custom workflows can be created using external workflow tools, such as SAP Build Process Automation. In the following example, we will show how to design a custom test confirmation workflow in SAP Build Process Automation (BPA) and enable it for Features in SAP Cloud ALM. When the user triggers the action “Confirm Successful Test” in a Feature, the workflow is automatically started in the BPA instance. A test confirmation request will be sent to the inbox of the dedicated approver. If the request is approved, the Feature status will be set to “Successfully Tested”. In case the request is rejected,  the Feature status will stay “In Testing”.Configuration PrerequisitesSAP Build Process Automation subscription and the corresponding service instance (including service key) are available.For more information, please see: https://help.sap.com/docs/build-process-automation/sap-build-process-automation/subscribe-to-sap-build-process-automationSAP Cloud ALM has been provisioned and a Cloud ALM API service instance has been created (including service key)For more information on how to create a Cloud ALM API service instance, please see: Enabling SAP Cloud ALM API Configuration OverviewCreate destination from SAP Cloud ALM to SAP Build Process AutomationCreate destination from SAP Build Process Automation to SAP Cloud ALMDefine workflow in SAP Build Process AutomationCreate workflow subscription in SAP Cloud ALMAssign the workflow subscription to a project in SAP Cloud ALMCreate destination from SAP Cloud ALM to SAP Build Process AutomationLogon to your SAP Business Technology Platform (BTP) subaccount where your SAP Cloud ALM tenant is provisioned. Navigate to the section Connectivity -> Destinations and create a destination with the following parameter:Parameter Name ValueType HTTPURL https://<url>/workflow/rest/v1/workflow-instances<url> = URL from the section endpoints -> api of the BPA instance service keyProxy Type InternetAuthentication OAuth2ClientCredentialsClient ID section uaa->clientid of the BPA instance service keyClient Secret section uaa->clientsecret of the BPA instance service keyToken Service URL TypededicatedToken Service URLhttps://<tenant>.authentication.<domain>.hana.ondemand.com/oauth/tokenfor <tenant> and <domain>, please refer to the URL from the section uaa->url of the BPA instance service key Create destination from SAP Build Process Automation to SAP Cloud ALMLogon to your SAP Business Technology Platform (BTP) subaccount where your SAP Build Process Automation tenant is provisioned. Navigate to the section Connectivity -> Destinations and create a destination with the following parameter:Parameter Name ValueType HTTPURL https://<your tenant>/apiProxy Type InternetAuthentication OAuth2ClientCredentialsClient ID section uaa->clientid of the Cloud ALM API instance service keyClient Secret section uaa->clientsecret of the Cloud ALM API instance service keyToken Service URL TypededicatedToken Service URLhttps://<tenant>.authentication.<domain>.hana.ondemand.com/oauth/tokenfor <tenant> and <domain>, please refer to the URL from the section uaa->url of the Cloud ALM API instance service keyAdd the following additional properties to the destination:sap.applicationdevelopment.actions.enabled = truesap.processautomation.enabled = trueDefine workflow in SAP Build Process AutomationHere is an example of a test confirmation workflow including a 4-eyes principle check and email notification to the test approvers:You can download the example workflow HERE, import it into your SAP Build Process Automation tenant and adjust it to your needs.Note, that the Feature status switch is done by using the Workflow API. When a workflow is accepted (workflow status COMPLETED), the Feature status will be set to “Successfully Tested”. In case a workflow is rejected (workflow status FAILED), the Feature status will remain “In Testing”. By using script tasks you can access the contextual information of the workflow and maintain optional attributes like externalApprovers or externalDecision which are maintained in the Feature history when a workflow is executed. For more information about script tasks, please check the following: https://help.sap.com/docs/workflow-capability/workflow-cloud-foundry/accessing-contextual-information-during-execution-of-script-tasks Please ensure that you have created an environment variable of type Destination under the project properties of your workflow project:At the project deployment you will be asked to map the Cloud ALM API destination (from SAP Build Process Automation to Cloud ALM) to the destination variable:Create workflow subscription in SAP Cloud ALMCreate a webhook in External API ManagementLogon to your SAP Cloud ALM tenant and navigate to External API Management:Go to Webhooks Management and choose “Add new webhook”:Enter the following data:Parameter Name ValueName<name of the webhook>Ext Resource TypeWorkflowDestination SourceBTP destinationDestination Id <id of the destination from SAP Cloud ALM to Build Process Automation tenant>Destination Type OtherCreate mappingGo to Mappings Management and choose “Add new mapping”:Enter the following data:Parameter Name ValueDescription<name of the mapping>Version1.0SourceSAP Cloud ALMDestination SAP Build Process AutomationMapping TypePayload BasedDownload the example mapping HERE and use it to define the mapping rules.For more information about mandatory and optional mapping, please check the corresponding sections of the Feature Workflow API guide: https://help.sap.com/docs/cloud-alm/apis/configuration-steps-for-workflow-api-for-features Add a subscription in External API ManagementGo to Subscriptions Management and choose “Add new subscription”.Enter the following data:Parameter Name ValueName<name of the subscription>Description<description of the subscription>TypeBuilt-inResource TypeWorkflowWebhook <name of the webhook you created before>Mapping <name of the mapping you created before>User Variable NameworkflowDefinitionIdUser Variable Value<workflow id>To get the workflow ID, logon to your SAP Build Process Automation tenant, navigate to Control Tower and go to the tile Environments. Choose the environment where you deployed your workflow. Go to Processes and Workflows, choose your workflow and copy the ID:This is how the example subscription looks like:Assign the workflow subscription to a project in SAP Cloud ALMNavigate to a project for which you want to use the Feature workflow and go to the Subscriptions tab. Assign the already created workflow subscription to the Feature entity:You are now able to execute test confirmations for Features in SAP Cloud ALM by using SAP Build Process Automation.   Read More Technology Blog Posts by SAP articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author