Compound conditions in actions and validations

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Define Forms > Customizing controls behavior > Actions and Validations >

Compound conditions in actions and validations

In many situations it is desirable to establish more complex conditions to perform an action or throw a validation. In the previous examples we learned how to define simple conditions. We will continue to define multiple conditions connected by the logical AND and OR operators and to establish groups of conditions.

 

Using the logical operators AND and OR in nested conditions

And and Or operators are used to link conditions and define them as being inclusive or exclusive. These operators become available in Actions & Validations when more than one condition is defined.

 

ActionsandValidations22

 

Example

Suppose in the Credit Request process, it has defined a policy for credit approval to reduce approval waiting times and offer a superior customer service.

 

This policy will apply to applicants age 25 and younger. If the requested amount is less than 3000 USD, the credit will be approved; otherwise, further analysis will be required.

 

The applicant's age is stored in the Applicant Age attribute.

The approval decision is stored in the Boolean attribute called Credit Approved.

 

We will value the Credit Approved attribute (true or false) in an action according to the condition:  

 

1. Go to the activity form, add the necessary controls and click the Actions & Validations icon located in the ribbon.

Add a new action by clicking the Add button.

 

ActionsandValidations26

 

 

2. Click Add a condition and define the first condition in respect to the applicant's age:

 

ActionsandValidations27

 

3. Add the second condition that evaluates the requested amount. Note the logical operator is now enabled.

 

ActionsandValidations28

 

4. Change the operator to and to define the inclusion of the component conditions i.e. to specify that both of these conditions must be met.

 

ActionsandValidations29

 

5. In the Then section define the action to perform when the condition is met. That is, assign TRUE to the Credit Approved control.

 

ActionsandValidations30

 

6. In the Else section, select Perform the following actions under the drop-down list.

 

ActionsandValidations31

 

 

7. As a default, assign FALSE to the Credit Approved control.

 

 

ActionsandValidations32

 

8. Click Ok to save the changes and then, save the form.

 

Using groups of conditions

You may need to define groups of conditions to built more complex evaluations. Each group of conditions has one or more single conditions linked by AND and OR operators. Likewise, groups are interconnected by AND/OR operators in order to define their inclusion or exclusion.

 

Groups of conditions are defined by clicking the Add a group condition button (found in the When group for actions and If group for validations).

 

ActionsandValidations23

 

Once clicked, a new condition block will be inserted within the conditions section.

 

ActionsandValidations24

 

Example

We will build on the example in the previous section. Suppose that a concession has been added to the credit approval policy for the more mature client .The new policy will be as follows:

 

If the applicant is 25 years of age or younger, and the requested amount is less than 3000 USD then the credit will be outright approved .

If the applicant is 60 years of age or older, and the requested amount is less than 6000 USD then the credit will be outright approved.

 

Recall that the approval decision is stored in the Boolean attribute Credit Approved. We need to define an action to set the value of this attribute (to true or false) based on the conditions defined:

 

 

1. Go to the activity form, add the necessary controls and click the Actions & Validations icon located in the ribbon.

Add a new action by clicking the Add button.

 

ActionsandValidations26

 

 

2. Click the Add a condition group:

 

ActionsandValidations36

 

3. Within the condition group block, define the two conditions for applications 25 years of age and younger.

 

ActionsandValidations37

 

4. Click the Add a condition group button to add another group.

 

ActionsandValidations38

 

5. Within the second block, define the two conditions for applications 60 years of age and older. First add the condition to evaluate the applicant's age.

 

ActionsandValidations34

 

6. Then add another condition to evaluate the requested amount.

 

ActionsandValidations35

 

7. Select the or operator to perform a logical exclusion on the two groups.

 

ActionsandValidations40

 

8. In the Then section, define an action to assign TRUE to Credit Approved control.

 

ActionsandValidations41

 

9. In the Else section, select Perform the following actions from the drop-down list.

 

ActionsandValidations42

 

10. The default action will be to assign FALSE to the Credit Approved control.

 

ActionsandValidations43

 

11. Click Ok to save your changes and then, save the form.