A Business Rule is a predefined set of instructions that guides an application’s behavior in response to specific events or conditions. It enables the application to make automated decisions (based on the predefined rules), ensuring processes run smoothly and consistently without requiring manual intervention every time.
A rule usually has two main parts:
Validation is the process of ensuring that data entered into a system meets specific rules, requirements, or standards before it is accepted or processed. It helps maintain data accuracy, by checking if the input is complete, correct, and appropriate as per the validation written.
For example:
Events in Business Rules and Validations allow you to control precisely when and how these rules are applied within your app. They determine the specific moments or actions during a transaction that trigger a rule or validation.
By defining events, you can:
Here’s a simple breakdown of the types of events in Rules and Validations:
Use case for Events
Objective: The application should enforce that no product can have a Quantity of less than 2. Additionally, if the Unit Price is 1000 or more, a 10% discount must be automatically applied to the Total Price, and the Final Price should be displayed.
Scenario:
1. Quantity Validation:
- Event: On Lost Focus (When Quantity field loses its focus in the application)
- Condition: Quantity < 2
- Action: Show validation message "Quantity must be more than 2".
2. Unit Price:
- Event: On Lost Focus
- Condition: Unit price ≥ 1000
- Action: Show "Discount Percentage" and "Discounted Price" fields.
These events allow you to control exactly when your business rules or validations are applied, making sure they only run when necessary and improving the performance of your app.
Use Case
To automate the school admission process by allowing only eligible students (with a score of 70+ in their previous academic records) to submit their applications. Upon meeting this requirement, the form's "Particulars" section becomes visible for further data submission.
Once a form is created, workflow admins are taken to the Rules and Validations page, where they can select "Create Rule." Upon doing so, a popup appears offering options to create a rule, validation, client script, or server script. Choose "Business Rule."
After selecting, a pop-up will appear allowing you to create a rule and in the "Rule Details" section give a name to the Rule.
Choose when the rule should be executed by selecting an option from the "Execute the Rule on" dropdown menu and Select the Workflow Step.
Select an event to determine when a rule should be triggered.
Note
The conditions are structured using IF, ELSE IF, and ELSE statements:
- IF: Checks if a specific condition is true. For example, "IF the user's age is over 18, then proceed."
- ELSE IF: Provides an alternative condition to check if the initial IF condition is false. For example, "ELSE IF the user's age is between 13 and 18, then display a warning."
- ELSE: Covers all other cases if neither the IF nor ELSE IF conditions are met. For example, "ELSE display an error message."
The Action section is to tell the platform that it should perform the defined action when the above-defined condition becomes true or satisfied.
Note
When specifying a condition in a rule or validation, you encounter expressions like IS, IS NOT, IS EMPTY, etc. These expressions are not explicitly defined in this article because their meanings are intuitive and easily understood.
Note
Utilizing business rules, you can now precisely define values for Link fields and transfer values from other fields (Set Field Value), such as Text and Calculate (String), in our application. This improvement empowers the Link field with dynamic hyperlinks, superseding the default static hyperlink.
Let's replicate the same use case scenario as we did for the business rules and generate validations.
Note
The process of defining/constructing a validation and business rule is same however, the functionality and application would differ as defined at the beginning of this article.
CGPA in Percentage: If the CGPA in percentage is less than 70, an error message will appear stating that only students with 70% or higher can continue with the application.
NLP (Natural Language Processing) in business rules allows citizen developers to use everyday language to create conditions in business rules, making it simpler and more user-friendly. For developers who feel defining/setting up conditions is a complex job, can express rule conditions in a way that is similar to how we talk or write in the NLP section. The NLP engine understands this language and converts it into the necessary instructions for the platform to follow. This means developers can create rules more easily and quickly without cussing on setting up conditions manually. NLP makes the process more accessible and intuitive, helping developers focus on the logic and requirements of their business rules rather than getting caught up in technical details.
Note
Sometimes, the intended meaning or expression may not be accurately captured in the NLP section. In such cases, our platform might not generate the expected condition as a result. However, you can easily make corrections on the fly to the platform-produced condition and obtain the desired definition for the condition.