In this blog post, you will learn how an event from SAP Cloud for Customer could initiate an instance in your SAP Cloud Platform Workflow Service using a SAP Cloud Platform Integration as middleware.
The use case is as following:
In SAP Cloud for Customer a sales employee set a sales quote to won, this should initiate a workflow and transfer specific quote information like items (products, prices, quantity) but also header information like account and description.
So, let’s get started.
Configuration in SAP Cloud for Customer:
Create an event notification in SAP Cloud for Customer:
Therefore, go to the work center Administrator à General Settings and open “Event Notification”.
Add a new consumer and define the endpoint of your iFlow. As soon as your iFlow is deployed you could find it in the SAP Cloud Platform Integration --> Monitor --> Manage Integration Content: Select your iFlow and on the right side you will see the endpoint.
Edit the event credentials and choose as authentication method “SSL Client Certificate”. A system key pair will be created and you could download the public key.
Add subscriptions in the table below. In the above mentioned use case a C4C event should get triggered as soon as a sales quote is set to won. Therefore, three subscriptions will be created:
Field changed from
Field changed to
1 – Not Relevant
3 - Won
2 - Pending
3 – Won
4 - Lost
3 - Won
As a last step, activate your consumer. The result will look like this:
C4C Event Configuration
2) Set a sales quote to won, to trigger the event. As a result, you will find an entry in the event monitor (Administrator --> General Settings --> Event Notification Monitoring):
This event provides the information which event was triggered and sends over the quote GUID.
iFlow Configuration in SAP Cloud Platform Integration:
The iFlow logic is as following: The C4C event gets send to the iFlow where it will be converted from JSON to XML. This is needed so that the quote GUID could be saved in the content modifier as a property and be used in the GET call to C4C to retrieve further quote attributes/information. This message is flowing into a message mapping where it is mapped to the workflow structure. The outcome is in XML. This must be converted to JSON. Again, a content modifier is needed to provide a content-type in the header of the message and now, it could be sent over to SAP Cloud Platform Workflow Service.
Let’s do it step by step:
1) Configure your inbound channel:
Use a HTTP channel and upload the downloaded public certificate from your SAP Cloud for Customer consumer. Provide an iFlow address. The SAP Cloud Platform Integration will add /http/ in between the CPI hostname and iFlow address during the deploying step, so that the iFlow endpoint will be:
For the workflow, the structure must be like this:
You could find a detailed documentation on the provided APIs for Workflow Management here.
The definition id is the created workflow definition and the context could be design individually. For this use case the structure should be like the C4C one.
I created an XSD with the help of an online tool.
6) SAP Cloud Platform Workflow Service is expecting the message in JSON. Therefore, an XML to JSON converter is used to format the message. Make sure to suppress the JSON root element, as this is not expected from the SAP Cloud Platform Workflow Service.
XML to JSON Converter
7) Use a content modifier for defining the Content-Type as “application-json”.
Content Modifier with Content-Type
8) Now, the message is ready to be send over to SAP Cloud Platform Workflow Service. Use a HTTP channel and define the address like this:
iFlow Outbound Channel
As credential use OAuth2 Client Credential. For this, create it in Monitor à Manage Security Materials. The Token Service URL could be found in the screenshot of the SAP Cloud Platform Cockpit below.
You will find all SAP Cloud Platform Workflow Service information like service URL and token information (token URL, client ID, client secret) in the SAP Cloud Platform Cockpit:
SAP Cloud Platform Cockpit
View result in SAP Cloud Platform Workflow Service:
Go to Monitor Workflows --> Workflow Instances and you will find your send message.