Policy rules are used to evaluate simple business conditions; an action is executed when the condition is fulfilled. These rules are based on If, Else and Then logical operators.
If contains conditions and can be combined with more than one condition using AND or OR operators.
Then contains the actions to be performed when the If condition is met.
Else contains the actions to be executed when the If condition is not met. Else can be left blank.
The conditions and the execution of actions depend entirely in the Vocabulary definitions.
In order to create Policy Rules follow the next procedure:
1. Go to the fourth step of the Bizagi Process Wizard and select Activity Actions.
2. Click the shape where the policy is to be created and select On Enter, On Save or On Exit to create the policy.
Select the Policy item.
3. Click on New on the upper left corner. In the new window, enter a name, display name and description for the policy.
Click on OK.
4. In the Policy Manager select New Policy Rule
5. A window will be opened where you can create and edit Policy rules.
6. Include the condition to be evaluated. Drop and drag Vocabulary definitions to the If condition box on the left.
Click the Add Condition button to include as many options as necessary to evaluate the rule.
The Vocabulary definitions used to create the If and Else conditions can only be defined by Constant or Xpath definitions configured to GET a value.
7. Enter the actions to be performed by dragging the Vocabulary you need to the Then box and assign the required values.
Actions can only be defined by Vocabulary created as Constant or Xpath definitions configured to SET a value.
By default, the Else box is hidden but can be enabled by selecting the option Use Else in the upper right corner of the window.
Drag and drop the relevant Vocabulary to the Else box.
8. When the Policy Rule is concluded, click Finish.
You will be asked to include the documentation information.
•Name: This is the name of the Policy rule in the data base. Once saved it cannot be modified.
•Display Name: This is the display name of the Policy Rule. You can change it any time.
•Description: Include any relevant information that explains the purpose of the policy.
•Priority: Establishes the relevance with which the Policy rule must be executed.
•Enabled: Defines if the Policy is enabled or disabled. When a policy is not in use it can be disabled.
•Enabled From Date: The Policy rule can be enabled for an specified period of time. This is the From date of that specific period.
•Enabled To Date: The Policy rule can be enabled for an specified period of time. This is the To date of that specific period.
Imagine you work in a bank and you need to create a policy that handles the scenario where a client starts the request application process but does not select any of the financial products offered. If a client does not complete the request, he or she will be penalized and are disallowed from making a new request for a certain period of time.
A Policy is created to penalize the client, as the activity finishes where the case is first created.
The following is the data model for the example.
We need to create two Vocabularies:
•In order to evaluate if any products were selected, we need to establish how many products are recorded in the Products collection.
•In order to penalize the client in the case where no products were selected, the Penalized attribute will be set on true.
To incorporate this Policy rule follow the next steps:
1.Go to the fourth step of the Bizagi Process Wizard and select Activity Actions.
Click on the shape where the policy is to be created and select On Enter, On Save or On Exit to create the policy.
Select the Policy item.
2. In the Policy Manager select New Policy Rule
3. The Policy Rule will open where you can create and edit the rule.
4. Include the condition to be evaluated.
In this case the condition will use a Vocabulary, that is an Xpath definition to obtain the number of records in the Products collection.
Right-click Xpath definitions and select New Definition.
Type a name, display name and description for the new Definition.
Click the Products collection in the data model and then select the Count function from the drop-down list located at the upper right corner.
The new Xpath definition has been created and you can select it from the Definitions menu. Drag and drop this definition to the first argument of the If condition.
We will compare if the product count is equal to zero. If it is zero, the client will be penalized. That is, if the Xpath definition is equal to 0, no records have been found in the Products collection and the client must be penalized.
5. Enter the action when the condition evaluates to TRUE: the request is closed. The Closed attribute must be set to TRUE.
We need to create a new Xpath definition to set a value to the Closed attribute. Repeat the procedure used to create an Xpath definition but select it as a SET definition of the action.
When clicking on Next you will be asked to select whether the Definition will be used to get or set a value. In this case we will set a value so select this option.
Drag the definition created to the Then box and assign it the TRUE value.
6. Define a name, display name and description for the new Policy.
The Policy rule has been created.