Business Rule
When creating, viewing, or editing a record, you can set business rules to modify the attributes of one or more fields (hidden, display, read-only, edit, required, etc.), or lock the record from editing, or you can compare the contents between fields and alert the operator.
Application Example
In the questionnaire, if the user selects [Unsatisfactory], a text field is showed to collect suggestions; if the user selects [Satisfactory], the text field is not required.
If the out-of-warehouse volume of a product is greater than its current inventory, it cannot be saved and the user is alerted.
When the status is [Approving], the record is locked and cannot be edited.
What are business rules for
- Business rules can help you hide or show some fields.
- Business rules can help you modify field attributes to read-only, editable or required.
- Business rules can help you lock a record, which cannot be edited, and automatically unlock the record when the rules are not met.
- Business rules can help you give the operator a pop-up alert.
Entrance to Business Rule
App Admin selects the target worksheet and goes to [Edit Form] > [Form Settings] > [Business Rules].
Set Business Rule
A business rule consists of a condition or a set of conditions, and an action or a set of actions.
Condition
You can add one or more conditions. Each condition consists of a condition field, a comparison relationship and a condition value.
Fixed value: In example 1, there are only two choices, and you can choose the fixed value (satisfactory or unsatisfactory) when setting the business rules.
Field value: In example 2, there is a comparison of the out-of-warehouse volume and inventory, and the product inventory will change at any time, so you should select the field value.
Action
You can set the following actions when the conditions are met:
- Show a field/fields
- Hide a field/fields
- Set a field to be read-only
- Set a field to be editable
- Prompt the operator
- Lock the current record
- Locking a record is only valid for worksheets, but not for custom buttons or workflows.
Example Configuration
Example 1. Show a field when the condition is met
Scenario: In the questionnaire, if the user selects [Unsatisfactory], a text field is showed to collect suggestions; if the user selects [Satisfactory], the text field is not required.
Configure Form
There are only two fields:
Field A: Are you satisfied with our documentation
Field B: Leave your suggestions
The desired effect
- Field B is showed and available to the user only when the user selects [Unsatisfactory] in Field A.
Set Rule
Set the rule for Field B.
A rule consists of displayed fields and conditions.
Condition: If Field A is [Unsatisfactory]
Action: Show Field B (the text field for suggestions)
Effect
Example 2. Prompt operator after comparing field values
Scenario: If the out-of-warehouse volume of a product is greater than its current inventory, it cannot be saved and the user is alerted.
Since the inventory is changing, select the field value.
Configure Form
Effect:
Basic Operations of Business Rules
- View/Edit rules
- Delete/Copy rules
- Sort rules
- Enable/Disable rules
Processing Logic for Conditions
If you set a business rule for a field, the processing logics when the condition is met or not met are as follows.
Note:
In line 1, Field A is set to [Show], and if the condition is not met, Field A is [Hide], regardless of whether the original attribute of Field A is [Show] or [Hide], because [Show] and [Hide] are mutually exclusive.
In Line 3, Field A is set to [Editable], and if the condition is not met, the original attribute of the field will be maintained and not set to [Read-only], because there is no unique attribute opposed to [Editable], it may be [Read-only] or [Required], so the original attribute of the field will be maintained if the condition is not met.
FAQs when Setting Rules
In the figure below, there are two rules set to show the [Promotion] field, but in this case, the field is hidden.
Reason:
As mentioned before, if the condition is met, the field is showed; if the condition is not met, the field is hidden. In this scenario, the source of the lead can only be one of “Advertisement” or “Email”, so if it meets one of the two, it must not meet the other one, and if it does not meet the rule, it will be hidden.
Modify:
For the same field, try to put it in one rule.
How business rules/workflows/roles and permissions affect the fields
Validation and Property of Field
- Hide
- Show (Show the field if you do not check [Hide])
- Read-only
- Edit (The field is editable if you do not check [Read-only])
- Required (If is field is editable, you need check [Required])
They are prioritized as [Hide] > [Show] > [Read-only] > [Required] > [Edit].
* Field A: If field A is set required (or a business rule makes it required), while Field A is hidden or read-only, since it can't be edited when it's hidden or read-only, so valiadation is not necessary.
* Field B: If business rule 1 makes Field B hidden, while business rule 2 makes Field B shown, then Field B is hidden.
You can modify the properties of a field on many pages, such as the configuration pages of fields, views, roles and permissions, custom buttons, workflows, and business rules. But how are they prioritized?
1. [Hide when create] > [Business Rule]
For example, if you check [Hide when create] for a field, the field is always hidden when you add records.
2. Business rules take precedence over the original properties of a field
If you set a business rule to display Field A, it will be displayed, even if you checked [Hide] when setting the original properties.
If you set a business rule to make Field A editable, it will be displayed and editable even if you checked [Hide] when setting the original properties.
- If it is set to required when you set the field attribute, there will be required or not validation as long as the field is editable; if the field is read-only, it is read-only.
3. If there are multiple business rules
Compare the rules, take the one with the highest priority, and overwrite the original properties of the field.
Example 1: for Field A, it is set to [Hide] in rule 1, set to [Show] in rule 2, set to [Editable] in rule 3, and you do not check [Hide] when setting the field properties, then Field A is [Hide].
Example 2: for Field A, it is set to [Editable] in rule 1, set to [Required] in rule 2, and set to [Read-only] when setting the field properties, then Field A is [Required].
4. Workflow/Custom Button/Role and Permission/Business Rule
Between any two of them, the property with the highest priority is retained, and overwrite the original property of the field.
In fact, as long as there are workflows, custom buttons, and business rules involved, the original properties of the field will be overwritten.
5. Lock Record
Locking a record according to the business rules only affects the operations in the worksheet, that is, the record is locked when you click it in the worksheet, but you can also edit the record in the following two ways.
- You can edit the fields with a custom button.
- You can open a record in nodes like [Fill in], [Approval] and [Station Notice] in workflows, the record remains editable and is not locked.
Processing Logic for Actions
If the fields involved in a business rule are hidden, there is an impact on the execution of the business rule, and different rules have different logics. There are two types of actions of the business rules.
- Prompt
- Non-prompt
- Show, Read-only, Hide, Required, Editable, and Lock
1. For unprompted errors
The business rule is valid as long as the condition field is not deleted.
2. For prompted errors
If A > 0, prompt: xxx
Example: If the out-of-warehouse volume is less than 10, there is a prompt “The out-of-warehouse volume must be more than 10”. If the field is hidden, there is no prompt.
If A > B, prompt: xxx
If A or B is hidden, execute the business rule.
If both A and B are hidden, ignore the business rule.
If A > 0 and B > 0, prompt: xxx
If A or B is hidden, check the two conditions and execute the business rule.
If both A and B are hidden, ignore the business rule.
If A > B or C > D, prompt: xxx
If A or B is hidden, follow the above logics.
If both A and B are hidden, ignore the rules of A > B and follow the rules of C > D.
Hiding fields refers to the following scenarios:
The properties of the field are hidden.
Hidden fields in the view.
Fields hidden according to business rules.
Fields that are not selected when setting the form visible to public.
Fields that are not shown in subforms or associated records.
Fields hidden in custom buttons of Approval or Fill-in.
Have questions about this article? Send us feedback