Understanding Business Rules in VBCS Business Objects
In this section, we will try to understand business rules in VBCS business Objects.
Business rules are used to validate business objects and fields and trigger action based on events or field changes.
Business Rules can be access using below navigation in VBCS:

We can define 5 types of business rules for business objects in VBCS:
- Object Triggers.
- Field Triggers
- Object Validators
- Field Validators
- Object Functions.
Let us explore one by one.
A. Object Triggers:
Like we have Database triggers on database tables, we have object triggers on business objects.
Object triggers is a script which is executed in response to a specific business object event.

Once you define object triggers, we can add condition and action as shown below:

Once we specify condition, we can add action as shown below:

This will create a new Action Group as shown.
Action group is a group of actions which we can execute once condition is satisfied.
VBCS provides below actions in Action Group:
Business Object:
This will enable us to perform actions on other business objects like creating records or deleting records etc.

Process:
This will enable us to call processes defined in Oracle Process Automation (OPA).

Other scripting:
This will enable us to print log messages or send email or to write any custom groovy script.

B. Field Triggers:
Field Triggers fires whenever a specific business object field changes in value.
Unlike object triggers which occur when any event happens, field triggers fires when specific field is changed.

It is listing all fields which are available in DeptBO.
Once we have created a field trigger, it will ask to define condition and action against that condition.

Once we specify criteria, it will ask for action as shown below:

Once we click on + Add Actions, it will again show all actions which are under the action group.

C. Object Validators:
Business object data can be validated against rules before submitting using object validators.

Once you define object validators, it will ask to define rules against which it will validate business object before submitting.

We can use Business objects/Functions/Services to define rules.
Also, we can make this object validators as Active/Inactive based on requirement.
We can define multiple object validators for one business object.

D. Field Validators:
Like object validators, we can also write rules or validations at field level which will be executed before submitting new values in the field.

Once you define field validators, it will ask to define rules or validations for that field.

We can refer to old and new values using field values. Also, we can refer to business objects, functions, service connections for adding validations.
We can make these rules validators as Active/Inactive based on requirement.
We can define multiple rule validators for one business object.

E. Object Functions:
Object functions are used to implement business logic for business object. Once we have defined object functions, we can call those functions from other scripts related to business object.


We can add parameters, business objects, functions and service connections to define object functions.
We need to use a groovy script for writing these scripts.