Business Rules
The Business Rule manager in Vahana vFlow 2.0 provides a framework for implementing logic by defining conditions or functions. It allows application users to specify expression-based rules that dynamically evaluate user actions. When executed, the business rule determines if the user’s action meets the specified condition, returning a “true” or “false” value. Based on the result, the application performs or skips the expected function.
Benefits
- Dynamic Validation: Provides real-time evaluation of user actions, ensuring data integrity.
- Increased Efficiency: Automates decision-making processes, reducing manual intervention.
- Improved User Experience: Enables responsive applications that adapt to user inputs.
Common Uses:
- KYC Validation: Automatically verifies customer data against regulatory requirements.
- Transaction Limits: Ensures payments and transfers comply with user-defined thresholds.
- Eligibility Checks: Validates loan or account eligibility criteria in real-time.
- Field Customization: Dynamically adjusts form fields based on customer input.
- Authentication: Evaluates OTPs, biometric inputs, or passwords for secure access.
Creating a New Business Rule
Business rules are created at either the element level or the task level, depending on functional requirements. When an end-user interacts with the application, the configured business rule executes and evaluates the user’s action against the specified conditions.
- If the condition is satisfied, the business rule returns a “true” value, and the application performs the expected function.
- If the condition is not satisfied, it returns a “false” value, and the function is skipped.
To access business rules:
- Access the Configurator Page
- Put your mouse on the left panel on the vFlow 2.0 Configurator page.
- The Configurator menu will expand.
- Navigate to the Inventory Section
- As the menu opens, click Inventory.
- Navigate to the Business Rules Section
- Then on the inventory menu located on the left, click Business Rules
- Create a Business Rule
- On the top of the page, click + Create ().
- The “Create Business Rule” dialog box opens.
- Enter the Name, and click Create.
Configuring Business Rules
Suppose you create a Business Rule; now define its basic and advanced properties like logic, messages, etcetera. Let’s discuss them one at a time:
Basic
Properties | Description |
Reference Name | The Reference Name acts as a unique internal identifier for the BR. This is visible to vFlow users for ease of reference but is hidden from end users. This allows users of the platform to manage and differentiate between tasks conveniently. |
Description | The Description field is intended for use by application designers or administrators (vFlow users) to provide additional context or details about the BR. This description is not visible to end-users and is used solely for internal reference to assist with task management. |
Statement | Here you can define the statement / function of logic like For ex getVal(‘userobject.role’) == ‘ADMIN’ |
Properties
Message
- Success: Display message when BR executed successfully.
- Failure: Display message when BR fails.
Click here to learn how to create a message.
Commonly used functions
Here is the list of the most commonly used functions:
BR Functions | Functions Syntax | Description |
getVal | getVal(jsonPath) | To evaluate value from the given path. |
setVal | setVal(jsonPath,value) | To set the value at the given path. |
CONCAT | CONCAT(..args) | To concatinate the multiple given string to a single string |
LOWER | LOWER(arg) | To convert the given string to lowercase |
UPPER | UPPER(arg) | To convert the given string to uppercase |
AVG | AVG(…args) | To calculate tha average of the number of arguments passed in the function |
MIN | MIN(…args) | To return the minimum value from the number of argument passed in the function |
ADD/SUM | MIN(…args) | To calculate tha sum of the number of arguments passed in the function |
DIVIDE | To separate the number of arguments passed in the function | |
SUBTRACT | DIVIDE(…args) | To calculate tha difference of the number of arguments passed in the function |
MAX | MAX(…args) | to return the maxmum value from the number of argument passed in the function |
MASK | MASK(str,startIndex,endIndex) | To mask(ie replace the given string by X) using startIndex and endIndex |
COUNT | COUNT(path) | To count the length of the string or array value obtained by the given path |
SUBSTR | SUBSTR(path,startIndex,lengthToExtract) | To get the part of the string obtained by the given path. |
COMPARE | COMPARE(str1,str2) | To compare the two given string. |
TOSTRING | TOSTRING(path) | To stringify the given value |
CHECKKEYINARRAY | CHECKKEYINARRAY(key,array) | To check for a particular key exist in given array |
ADDOBJINARR | ADDOBJINARR(obj,arr) | To add object in a given array |
FILTER | FILTER(key,filterFrom,value) | To filter from an array of objects |
FORMATDATE | FORMATDATE(date,fromFormat,toFormat) | To change date from one date format to another |
FORMATTIME | FORMATTIME(time,fromFormat,toFormat) | To change tim from one time format to another |
SETDATE | SETDATE(datePath,addorSubtract,day,month,year) | To add days,month or years to a particular date. |
IN | IN(path,array) | To check whether the value obtained by path exist in the array or not. |
ADDDAYS | ADDDAYS(date, dateFormat, NoOfDays, outPutDateFormat?) | To add number of days in the given date. |
ADDMONTHS | ADDMONTHS(date, dateFormat, NoOfMonths, outPutDateFormat) | To add number of months in the given date. |
ADDYEARS | ADDYEARS(date, dateFormat, NoOfYears, outPutDateFormat) | To add number of years in the given date. |
SUBDAYS | SUBDAYS(date, dateFormat, NoOfDays, outPutDateFormat?) | To subtract number of days from the given date. |
SUBMONTHS | SUBMONTHS(date, dateFormat, NoOfMonths, outPutDateFormat) | To subtract number of Months from the given date. |
SUBYEARS | SUBYEARS(arg, dateFormat, NoOfYears, outPutDateFormat) | To subtract number of Years from the given date. |
DATEDIFFDAYS | DATEDIFFDAYS(date1,date1Format,date2,date2Format) | To calculate the difference between the number of days of the 2 dates given |
DATEDIFFMONTHS | DATEDIFFMONTHS(date1,date1Format,date2,date2Format) | To calculate the difference between the number of months of the 2 dates given |
DATEDIFFYEARS | DATEDIFFYEARS(date1,date1Format,date2,date2Format) | To calculate the difference between the number of years of the 2 dates given. |
DAYSDIFFFROMNOW | DAYSDIFFFROMNOW(date,dateFormat) | To calculate the difference between the number of days from the current date |
MONTHSDIFFFROMNOW | MONTHSDIFFFROMNOW(date,dateFormat) | To calculate the difference between the number of months from the current date |
YEARSDIFFFROMNOW | YEARSDIFFFROMNOW(date,dateFormat) | To calculate the difference between the number of years from the current date |