Example Me.Context
From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS
<keywords content="keywords">context, business rule, example</keywords>
Example Me.Context
Click for further information about Context
In a loan request process the customers’ income is an important variable. According to the bank's policies, a loan cannot be granted to a customer who has an annual income of less than $15,000 and every customer with an annual income greater than $90,000 has to be verified. Me.Context is used to check this policy for every customer in the request.
This is the process:
The validations that are required will be controlled from the Request activity, in order to give immediate feedback to the customer and to make sure that only valid cases arrive to the Pre-Approval activity in Risk Management.
This is how the information will look in the Request activity.
This is how it will be seen in the first activity, so the user can inform the customer, in case they have an income higher than $90,000.
If the customer has an income less than $15,000, a message is displayed to the user when adding the customer as shown below.
The validations will be performed using the following data model.
Notice that a request may have more than one customer and a customer may be in more than one request (N-M relationship). Also, an unlinked entity called Parameter is created in order to make the reference to low and high income (in this case $15,000 and $90,000 respectively) that is easily modifiable from the Web Application at any time.
The first part of the rule to accomplish this task is as follows :
The continuation of the rule looks like this.
The variables that were declared at the beginning of the rule are :
The first Expression in the rule called Get Properties is as follows :
The second part of the rule uses Me.Context for the first time to get the value of the customer using the context of the rule.
In the first part of the rule, the high and low income values are saved from the unlinked table called Parameter. It is a good practice to use a Parameter entity to save the values that may change in time and that affect Expressions. This allows changes to be made easily from the Web Application. The Parameter table looks like this:
Note: A column named Code is created to be used as reference because the id should not be used for this type of situation.
This is the IF condition that is located at the far left of the rule, which handles customers with insufficient income.
The Expression called Error Message which lies below the previous IF condition should include the following.
The next IF condition located below the first ELSE at the top right in the rule, contains this condition.
Below the previous IF condition, the expression called Set Value should express this.
Here Me.Context is used again to set the indicator for customers whose income is to be verified. The context of the rule can be used repeatedly and the variables handled easily.
To make the rule created work as shown in the beginning of the example, it has to be included in the form of the Request Loan activity as a validation in the Edit Form of the list (or grid) of customers in the request.
Go to the Step 3: Define Forms in the Process Wizard. Open the process and click on the activity to open the form.
Right click on the grid where the rule is going to be included and select Edit Display Form
A second tab will open where the user should click on the grid to see the properties of the grid on the left of the form. In the Grid properties, click on the space available in the option Edit Form Validation and then click on the box
.
The Expression Selection window will open for the user to select the rule if it is already created, or to click on the New button if it is going to be created.
Note that Me.Context is most useful in rules that handle a different context than the PV entity (in this example it refers to the Credit entity found in the data model presented at the beginning of the example) . Other uses of Me.Context is in Expression rules associated (in a different context) to buttons and to specific properties of fields in forms such as Required, Editable and Visible.
Related Topics
<comments />