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:

  1. KYC Validation: Automatically verifies customer data against regulatory requirements.
  2. Transaction Limits: Ensures payments and transfers comply with user-defined thresholds.
  3. Eligibility Checks: Validates loan or account eligibility criteria in real-time.
  4. Field Customization: Dynamically adjusts form fields based on customer input.
  5. 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:

  1. Access the Configurator Page
    • Put your mouse on the left panel on the vFlow 2.0 Configurator page.
    • The Configurator menu will expand.
  2. Navigate to the Inventory Section
    • As the menu opens, click Inventory.
  3. Navigate to the Business Rules Section
    • Then on the inventory menu located on the left, click Business Rules
  4. 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

PropertiesDescription
Reference NameThe 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.
DescriptionThe 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.
StatementHere 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 FunctionsFunctions SyntaxDescription
getValgetVal(jsonPath)To evaluate value from the given path.
setValsetVal(jsonPath,value)To set the value at the given path.
CONCATCONCAT(..args)To concatinate the multiple given string to a single string
LOWERLOWER(arg)To convert the given string to lowercase
UPPERUPPER(arg)To convert the given string to uppercase
AVGAVG(…args)To calculate tha average of the number of arguments passed in the function
MINMIN(…args)To return the minimum value from the number of argument passed in the function
ADD/SUMMIN(…args)To calculate tha sum of the number of arguments passed in the function
DIVIDETo separate the number of arguments passed in the function
SUBTRACTDIVIDE(…args)To calculate tha difference of the number of arguments passed in the function
MAXMAX(…args)to return the maxmum value from the number of argument passed in the function
MASKMASK(str,startIndex,endIndex)To mask(ie replace the given string by X) using startIndex and endIndex
COUNTCOUNT(path)To count the length of the string or array value obtained by the given path
SUBSTRSUBSTR(path,startIndex,lengthToExtract)To get the part of the string obtained by the given path.
COMPARECOMPARE(str1,str2)To compare the two given string.
TOSTRINGTOSTRING(path)To stringify the given value
CHECKKEYINARRAYCHECKKEYINARRAY(key,array)To check for a particular key exist in given array
ADDOBJINARRADDOBJINARR(obj,arr)To add object in a given array
FILTERFILTER(key,filterFrom,value)To filter from an array of objects
FORMATDATEFORMATDATE(date,fromFormat,toFormat)To change date from one date format to another
FORMATTIMEFORMATTIME(time,fromFormat,toFormat)To change tim from one time format to another
SETDATESETDATE(datePath,addorSubtract,day,month,year)To add days,month or years to a particular date.
ININ(path,array)To check whether the value obtained by path exist in the array or not.
ADDDAYSADDDAYS(date, dateFormat, NoOfDays, outPutDateFormat?)To add number of days in the given date.
ADDMONTHSADDMONTHS(date, dateFormat, NoOfMonths, outPutDateFormat)To add number of months in the given date.
ADDYEARSADDYEARS(date, dateFormat, NoOfYears, outPutDateFormat)To add number of years in the given date.
SUBDAYSSUBDAYS(date, dateFormat, NoOfDays, outPutDateFormat?)To subtract number of days from the given date.
SUBMONTHSSUBMONTHS(date, dateFormat, NoOfMonths, outPutDateFormat)To subtract number of Months from the given date.
SUBYEARSSUBYEARS(arg, dateFormat, NoOfYears, outPutDateFormat)To subtract number of Years from the given date.
DATEDIFFDAYSDATEDIFFDAYS(date1,date1Format,date2,date2Format)To calculate the difference between the number of days of the 2 dates given
DATEDIFFMONTHSDATEDIFFMONTHS(date1,date1Format,date2,date2Format)To calculate the difference between the number of months of the 2 dates given
DATEDIFFYEARSDATEDIFFYEARS(date1,date1Format,date2,date2Format)To calculate the difference between the number of years of the 2 dates given.
DAYSDIFFFROMNOWDAYSDIFFFROMNOW(date,dateFormat)To calculate the difference between the number of days from the current date
MONTHSDIFFFROMNOWMONTHSDIFFFROMNOW(date,dateFormat)To calculate the difference between the number of months from the current date
YEARSDIFFFROMNOWYEARSDIFFFROMNOW(date,dateFormat)To calculate the difference between the number of years from the current date

Was this article helpful?
YesNo