Applies to version: 2022.1.1 and above; author: Krystyna Gawryał
Form rules, as the name suggests, are rules that define the behavior and appearance of form elements. The vast range of available options such as functions, operations, integrations, and operators allows a user to create more or less complex rules, depending on the user’s needs. When working with form rules, there may be a situation where execution of one function or subrule interrupts execution of the entire rule. Consequently, the rest of the rule is not executed.
This article provides a detailed description of the reasons for this behavior and a proposal for creating rules so that they work as intended by their author.
Creating a form rule requires the use of a specific function/operator. Some of them, for example CONFIRM, are functions that return a value.
This function will return a TRUE or FALSE logic value in the rule, depending on the operations performed by the user on the form.
Note, however, that in such a case – i.e. after the function returns a value – the rule execution will end. Therefore, if the rule further (after CONFIRM) contains other functions, conditions or subrule calls, they will not be executed.
The following is an example of incorrect use of the CONFIRM operator in a form rule containing a double condition.
[Main PKD code validation] is a subrule that checks whether the bidder’s main PKD code is one of the codes required in the tender procedure.
[PKD code validation] is a subrule that checks whether any of the PKD codes defining the type of bidder’s activity complies with the requirements.
The author’s intention was to create a rule that would first check whether the bidder’s main PKD code entered on the form complies with the terms of the tender procedure, and then whether their other PKD codes are also compliant.
Example of incorrect use of a form rule with a value-returning function
As mentioned above, the execution of the rule will end after the first condition (1) is met, while the second part of the rule (2) will never be executed.
In order for the entire form rule to be executed as the author intended, with no part of it being omitted, the rule must be correctly formulated.
Using the example of a form rule with two IF THEN conditions, which additionally includes the CONFIRM function that returns a TRUE or FALSE value, the rule should be as follows:
In this case, both subrules will be executed one after the other and both conditions of the parent rule will be checked.
Another important feature of form rules is that in the absence of a defined value return by the rule, it will return FALSE by default.
This is especially important for rules executed, for example, as additional validation on path.
In the rule below, although the amount of the price offer will be lower than EUR 25,000, the rule will return FALSE and the path will not be completed.
Correctly (as intended by the author), the rule should be as follows:
If the amount of the price offer does not exceed EUR 25,000, the path transition will occur. On the other hand, if this amount is higher than EUR 25 000, the path transition depends on the user’s decision, i.e. on whether they select OK or CANCEL in response to the displayed system message.
CONFIRM is one of many functions for form rules that return a TRUE or FALSE value. Examples of other such functions are:
These functions are described in detail in the article: Function dictionary for Business Rules and Form Rules (webcon.com)