Did you know we take around 35.000 decisions everyday?
"What do I wear? What do I eat? Shall I go to the gym?"
And we do not take decisions on a random basis: we need input and context:
"What's the weather? What did I eat yesterday? Is that shoulder still hurting?"
This decision-taking-spree also applies to the business world: business rules can help to simplify implementation and maintenance of simple to complex decisions - in business processes, integration flows or applications.
The goal of this blog is to guide you through the creation of a SAP BTP Business Process Automation business rule as well as explaining how to call that business rule through an API Call.
In order to follow the steps hereunder, I recommend that you have:
Open your SAP Build Process Automation environment and click on "Build an Automated Process".
Select "Business Process".
Give your project and name and click "Create".
Hit the "Cancel" button when asked to create a process.
On the canvas of your project, select "Create/Decision".
Give it a name that will fit to your project.
The decision is now created and we need to configure it. To do so, we start with the Input and Output parameters. Click on "Add input parameters".
In our case, we use an example of associating a support group to a ticket, based on the ticket type and ticket urgency. Hence we need "TicketType" and "TicketUrgency" as input parameters (as strings) and "SupportGroup" as output parameter.
Once in- and output are defined, we can add a rule to our decision. Click the second step of the decision graphic and click on "AddRule" on the right.
As we keep things simple, we will use a "decision table". Enter the name and description as fitting your project, and click "Next Step".
It's now time to define the actual conditions of the rule. Select the input parameters you just defined and define their label (friendly name) and set the operator to "equal" ("="). Once done, click on "Next step".
Same as you did for the conditions, select "SupportGroup" to be a result a click on "Next step".
Once you have reviewed the conditions, click on "Create".
Now that you have defined input, output and conditions, you can define the actual content of the rule.
In the decision table on the right, enter the actual data of your business rule as depicted below. Once you are done, click on "Save".
Now click on "Release".
Once a rule is released, it can be deployed. To do so, click on the "Deploy" button at the top right of your screen.
The business rule is now available for use. Before you move to another screen, it is important that you save the ID of the business rule somewhere: it will be used later in our API call to uniquely identify the decision.
Click on the "..." button at the top right corner of the screen and copy the "Id" information.
Almost every service in SAP BTP can be access through APIs. To allow that access however, you need to define a service key.
If you haven't done it yet, create an instance of the SAP Build Process Automation. To do so, navigate to the "Instances and subscriptions" section of your subaccount and click on "Create". Select the SAP Build Process Automation service, pick the right plan and give it a meaningful name.
Click on "Next" and "Create".
Now locate that service instance you have just created (or that was already there) and click on it. On the right side of the screen, you can see the service keys - if any. If you need one, click on "Create".
This process is self-explanatory, simply give the key a meaningful name and click "Create".
Once created, you can see all it's details that you need for an API Call.
It is a good idea to download or copy the service key now, so you can use it later.
Now that you have created a business rule, written down its Id and created a service key to access it, let's move to the API call.
I recommend to use the useful authorization feature on the folders or collection level so you do not need to reconfigure authorization for every SAP Build Process Automation business rule API call.
Open your API client - in our case Postman - and configure the authorization as follows:
As per the documentation available on the SAP Business Accelerator Hub, decisions can be called through the POST method, passing the input as raw body.
Also in the documentation, you can find the endpoint of the API for your environment.
In Postman, create a new request in your collection or folder on which you previously defined the Authorization.
The API Call should be configured as follows:
{
"RuleServiceId": "fc3dde4285db06a702f3ed748006434e",
"Vocabulary": [
{
"TicketUrgency": "High",
"TicketType": "HR"
}
]
}
This is what the request eventually looks like.
Thanks to SAP Build Process Automation, not only can you build human-centric processes, but you can also create centralized, re-usable and openly available decisions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
28 | |
27 | |
14 | |
13 | |
12 | |
10 | |
8 | |
7 | |
7 | |
6 |