Business Rule
When creating, viewing, or editing data in 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 then alert the operator.
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.
- 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-stock volume of a product is greater than its current inventory, it cannot be saved and the user is alerted.
- If the out-of-stock 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.
- 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
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 up the business rules.
Field value: In example 2, there is a comparison of the out-of-stock volume and inventory, and the product inventory will change at any time, so it should be selected as the field value.
Action
The actions that can be set when the conditions are met are the following:
Show a field/fields
Hide a field/fields
Set a field to read-only
Set a field to be editable
Prompt the operator
Lock the current record
The above is only valid for worksheets, but not for custom buttons or workflows.
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
2. Prompt after comparing field values
Scenario: If the out-of-stock 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 for Business Rules
- View or edit rules
- Delete or copy rules
- Sort rules
- Enable or disable rules
Processing Logic for Conditions
If you set a business rule for a field, the processing logic when the condition is met and when it is not met is 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 is [Show] or [Hide], because [Show] and [Hide] are mutually exclusive.
- 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.
FAQ 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 rules, it must not meet the other rule, 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 and 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].
You can modify the properties of a field in many interfaces, such as field configuration, 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.
3. If there are multiple business rules
Compare the rules, take the one with the highest priority, and then overwrite the original properties of the field.
- Example 1: for Field A, it is set to [Hide] under rule 1, set to [Show] under rule 2, set to [Editable] under rule 3, and you do not check [Hide] when setting the original properties, finally Field A is [Hide].
- Example 2: for Field A, it is set to [Editable] under rule 1, set to [Required] under rule 2, and set to [Read-only] when setting the original properties, finally Field A is [Required].
4. Workflow, Custom Button, Role and Permission, and Business Rule
Between any two of them, the property with the highest priority is retained, and then the original property of the field is overwritten.
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 on 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 a node 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 logic. There are two types of actions of the business rules.
- Prompt
- Non-prompt
- Show, Read-only, Hide, 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 outbound is less than 10, there is a prompt “The outbound must be more than 10”. If the field is hidden, there is no prompt.
If A > B, prompt: xxx
Example: Outbound > Inventory, prompt: xxx
When the condition field (Outbound) is hidden, execute the business rule.
When the condition field (Inventory) is hidden, ignore the business rule.
When both the fields outbound and inventory are hidden, ignore the business rule.
If A > 0 and B > 0, prompt: xxx
If A is hidden, only consider whether B is greater than 0.
If B is hidden, only consider whether A is greater than 0.
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 logic.
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:
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.
Have questions about this article? Send us feedback