Pattern 1 – In App Extensions for Cloud Applications
This is the second blog of my
blog series on
Business Rules Consumption Patterns. In previous
blog on Usage Scenario#1 of Pattern 1, I explained how business rules can be used directly from your custom applications which is deployed on SAP Cloud Platform.
Usage Scenario #1
Embed Business Rules SAPUI5 control in your custom applications
Business Rules can be also managed by the applications build by customers & partners. It gives the flexibility to provide an custom interface to the business users to directly manage rules without exposing the technical aspects like data-types, rulesets, rule service etc.
This is achieved by embedding
Rule Builder SAPUI5 control in your custom application. Rule Builder is available from version 1.40 in SAPUI5 control library.
- Follow muralidaran.shanmugham2's excellent blog where he very nicely explains how to embed the rule-builder control in your application and then access it via Fiori Launchpad
Here are some important touch points in the SAPUI5 application (where you will embed the Rules Builder control) are:
- Coding your view.xml file to embed Rule Builder UI control of type Decision Table as shown:
<rules:RuleBuilder id="ruleBuilder" types="DecisionTable" editable="{path:'IsDraft', formatter: '.formatterIsDraft'}"/>
- Coding you Controller.js file to (a) initialize vocabulary, (b) configure and setup Rule Builder control, (c) implement actions for Activate, Edit, Deploy and Cancel buttons
You can know more in SAPUI5 samples to learn more on how to do that:
https://ui5.sap.com/#/entity/sap.rules.ui.RuleBuilder
- Deploying the application after you have embedded and coded the business rules control
- Accessing the application via the available application url. At a time, you can manage single rule via the rule builder control. The rules builder control needs information like rules project ID, rule ID, rules service ID and rule version, to be able to load the respective information.
Note: Currently only decision table based rules can be authored and managed using rule builder control. Soon, we will also release text-based rule builder control as well.
In this blog you learned about
Consumption Pattern #2 where you saw how you can embed a decision table SAPUI5 control in your application. All you need to do is: (a) Insert the RuleBuilder control in your view.xml , (b) Implement the
Controller.js to load the metadata of the rules via public APIs, (c) Code the button actions for Activate and Deploy (c) Finally, Deploy the application from SAP WebIDE and (d) Access the application to manage the business rules.
Sample Reference Application
I have shared a
rulesmanager.zip project in
GitHub which you can use to learn and reference on how-to embed the business rules in your application in your Neo environment.
(Instructions are simple and available in
README file)
Related Blogs
SAP Cloud Platform Business Rules – Extensions and Consumption Patterns
Use SAP Cloud Platform Business Rules in your custom applications
Using Business Rules in SAP Cloud Platform Workflow
Embed Business Rules in Cloud Foundry Application