Skip to Content

Quick Start Guide to SAP Cloud Platform Business Rules Service in Cloud Foundry

SAP Cloud Platform together with Cloud Foundry is offering the flexible cloud native enterprise platform to build, deploy and manage applications. SAP is key member and contributor in Cloud Foundry community. There have been great advantages of Cloud Foundry in SAP’s platform-as-a-service strategy, due to which SAP Cloud Platform services in Neo environment have already started being provisioned in Cloud Foundry. Business rules is one of them

SAP Cloud Platform Business Rules Service in now available in Cloud Foundry Trial environment – for both platform-as-a-service (PaaS) and software-as-a-service (SaaS) engagement model. It has been released currently for CF/AWS environment in Europe(Frankfurt) trial data centre.

I have put together this quick guide series that introduces you to the business rules service in Cloud Foundry where I have divided the learnings into 2 parts:

  • In first part, you will learn how to subscribe to business rules application, use rules editor to model, manage and deploy rules and execute/test business rules service in Cloud Foundry
  • In the second part, you will learn on how to consume the service from custom application deployed in Cloud Foundry.

In this first blog, I will concentrate on how you can use business rules application in Cloud Foundry in just four steps: (a) Business Rules Application Subscription, (b) User Role Assignment, (c) Accessing Business Rules Editor application to model rules and (d) Creating service instance and service keys to execute the business rules

I. Enable Business Rules Application Subscription

  1. Login to SAP Cloud Platform trial

[Note: If you are not a registered user then first sign-up for the trial account and then login with the set username and password.]


  1. Click on Cloud Foundry Trial to create (if you are login for the first time) and open the trial account. Cloud Foundry is a limited period trial for first 90 days and then you can choose to extend it for another 30 days.


  1. You will see that a global account and subaccount is already created for you with name <your-user-name>trial and trial respectively, as shown. Click on Go to Space

As a concept in Cloud Foundry accounts management, Global account represents the scope of the functionality and operations you are exposed to. A global account can have one or more sub-accounts that allows you model, deploy and manage your services and applications. For more information, you can read here


  1. Click on the trial subaccount tile to navigate into the account. It is from this subaccount that we are going to subscribe and configure business rules service.

In the Overview page you will see all the quota assigned for various services and memory allocations for applications in your trial account. This quota or resource allocation defines which and to-what-extend you can use specified set of resources.


  1. Click on the Subscriptions (from left vertical panel) and click on tile to open the business rules standard application configuration page. In this page, click on the Subscribe button to enable the business rules application to be used.

… wait for the subscription to complete and once done successfully, you will see the business rules is shown as Subscribed


  1. Open Manage Roles to see various roles provided with the subscription. RulesRepositorySuperUser is to get access to rules editor and repository APIs to model and manage rules. RulesRuntimeSuperUser is to get access to deploy and execute rules.


II.  Configure Trust and Assign Authorizations

  1. Open your trial subaccount and go to Members. Check if your username is already added. As this is a trial account, you should be already a member, by-default.


  1. To assign business rules roles, first you need to create the role collection. For that, open Security –> Role Collection and add a new role collection with name of your choice let’s say “Business Rules”. If you already have a role collection where you want to add business rules roles, then you don’t need to create a new collection.



  1. Go into the role collection to add 2 roles (RuleRepositorySuperUser and RuleRuntimeSuperUser of bpmruleseditor application) to the collection. These roles are required to access the business rules editor to model, manage and deploy rules.


  1. Open Security –> Trust Configuration to assign the role collection to your IDP service (which is SAP IDP is case of trial)


Enter your user id or email address to see what role collections are assigned to you. To assign the newly created role collection to your user, use Add Assignment option. If you already have a role collection where you just want to assign role associated with business rules, then you do not need do this step.


III. Access Business Rules Editor Application

Before I start this section, I would like to highlight certain things about business rules editor. To those who are aware of business rules editor in Neo environment – there is absolutely no change. Infact the editor in Neo and Cloud Foundry is EXACTLY the same. No learning experience required.

For those who have not seen/used business rules editor before, follow the blogs to know how-to model, manage and deploy rules. This section would not cover modelling of the rules. I would recommend you to go-through the blogs to familiarize yourself with modelling notations and operations for business rules.

Assuming that you know how-to work with business rules editor, let us understand how to get access to the editor.


  1. Open the business rules application subscription in your trial account, and click on Go to Application link to open the business rules editor

… this logins you to the business rules editor – which is your one-stop to model, manage and deploy your business rules in Cloud Foundry.

So, now you have subscribed to the business rules application, assigned all desired roles to your user and opened the editor for modelling.

You can choose to model your own rules or as a sample you can import Shopping Cart Promotion Rules from GitHub. If you opt for latter, then after you have imported the rules, you need to activate the artefacts (in this given order: Data Objects, Rule Services, Rules and Rulesets) and deploy the rule services. As you deploy the rule service, a REST service is created which can be accessed via business rules runtime public APIs.

IV. Use Business Rules Service Broker to invoke rules

In the previous sections, you learnt how you can enable/subscribe business rules application in Cloud Foundry and access the rules editor to model, manage and deploy rules. In this section, you will learn about the service broker of business rules – which will be used to create service instance and execute rules in the platform. I will also show you how you can test your rules from any available rest client using service keys of a service instance.

  1. Open your Global Account in Cloud Foundry trial and go to Entitlements


  1. Check if you can see Business Rules Service Broker and then navigate to the trial subaccount



  1. While working on trial, a dev space would already have been created for you. Go into the dev space to create service instance and bindings


  1. Open Business Rules service from Service Marketplace and create a new instance with name of your choice. For more information on services in Cloud Foundry, read here


While creating the service instance keep all the options as they appear by default and give the Instance Name of your choice.

  1. Now lets us create service keys that will generate credentials which will be used to communicate with the service instance. To do so, navigate into the service instance you have created above

  1. Switch to Service Keys and create a new service key with name of your choice

Here you have to note down certain values because we use them while testing our business rules from rest client and also when you want to consume this service from your custom application:

  • clientid: used as username for any grant-type option
  • clientsecret: used as password for any grant-type option
  • url: used to generate the authorization token to access APIs
  • runtime_url: host url to execute the rules runtime APIs
  • repository_url: host url to execute rules design time APIs
  1. Now you have to assign roles (to your user) associated with the service instance of this business rules service broker. You can either create a new role collection or update the existing one.

… and then configure your IDP for new role collection

As final step, let us now test the rule service from any rest-client. I will use Postman here, but you can use any available client you have.

  1. Open Postman and get the access token first. Here are the details:

Method: POST

where is the url from service key

Authentication: Basic Auth
Username: < clientid>
Password: <clientsecret>

Content-Type: application/x-www-form-urlencoded

grant_type: password
response_type: token
username: <your cloud foundry trial username>
password: < your cloud foundry trial password>


when you make the call, you will get the access token in response body. This is the bearer access token that you will use to execute the rules.

  1. Create a new tab in Postman and enter following details according to your trial. As an example, I am executing the sample Shopping Cart Promotion Rules that I referred in the previous section. If you have your own rules, then you need to change the URL and body accordingly.


Method: POST

URL: v1/rule-services/java/ShoppingCartPromotionRules/DiscountRuleservice

where is the runtime_url from service key

Content-Type: application/json
Authorization: Bearer <access_token>





       “Category”:”Flat Screen TVs”,


       “Soldby”: “Very Best Screens”




       “Name”: “Very Best Screens”



when you execute the business rules, you can see the discount output from the rules in the response body as shown. [Note: I am also showing you the snippets of the decision table rule so that you can understand the response we got after execution of the business rules]


You can also run repository APIs (in similar fashion) to model and manage the business rules (in case you do not want to use the editor and work on purely PaaS model). In the above example, I showed you how to authenticate business rules runtime APIs with password-grant type, but you can also use other grant-types to call the service.

This concludes the first part of the blog where I focussed mainly on business rules application subscription and using business rules service broker instance to model, manage, deploy and invoke rules. I will soon publish the second part of the blog, until then try and use the business rules service in Cloud Foundry and connect back to me if you have any queries or feedback.

♦ Second part of the blog is published now!

You must be Logged on to comment or reply to a post.