Entity Expressions
From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS
<keywords content="keywords"> Entity, expression, grid, context </keywords>
Entity Expressions
Entity Expressions are those expressions that can be reused only in the entity where they are created. In these expressions, the context is the entity itself, that is, they can only use the attributes of the entity where they belong. Usually, Entity Expressions are used as visibility, editability and mandatory rules in forms, as properties of the fields.
How to Create an Entity Expression
The following example illustrates how expressions can work in a context different to the application entity, and how the Expressions can be reused. A Boolean Expression will be used in the visibility property of the Document Number field to show it or hide it according to a condition. In the image below the user can see that the Document Number is not visible. It will only be visible if the ID value is selected in the Document Type combo.
1. In order to create the expression that will be associated to the visibility property, the user should edit the Activity Form.
Go to the Third Step in the Process Wizard and click on the activity.
The Activity Form in this example is "Register Client and Vehicle Data". The appearance of the form in the web application can be found in the image below. The visibility of the Document Number field will be modified in the Edit form of the Client's table (or collection).
After clicking in the Edit Form option in the Global Properties task, the Forms Designer will be displayed. Here, the user can create or edit forms. The Forms Designer will display the attributes included.
2. Go to the Clients table and select it in order to open its Edit Form.
When the Table (or collection) form is edited, the entity to drag and drop the attributes to the form will change. When the Forms Designer opened, the Business Main Entity was displayed. Now, there is a context change and the user will enter the collection entity.
3. In the Edit Form of the grid (or table) select the Document Type attribute. Since the visibility rule depends on a value selected on the Document Type combo, this attribute must have the "Submit on Change" property selected. This will allow Bizagi to execute the visibility expression as soon as the user selects a value in this combo in the web application.
4. Then, right click on the Document Number attribute and select Expression for the Visibility Property.
This will open a window to create an Expression, and define the visibility conditions of the field. In this case, the expression will evaluate the value selected in Document Type in order to show or hide the Document Number field.
5. Click the reusable checkbox in the upper right corner as shown in the picture below. This will allow the expression to be reused in any other form whose context is the Client Insured entity. In this example, the visibility of Document Number depends on the value chosen on the same form in Document Type.
6. Since it was not selected previously, an Advanced Expression is needed. Click on Cancel on the expression window.
A new window will appear where the user can select between previously created expressions and Default Expressions. To create a new expression, click on Advanced on the bottom left corner and then, click the New Scripting button.
7. The user should write in the expression the conditions required to show or hide the field.
8. Finally, the rule will be executed in the web application. In the picture below, the user can see that Document Number is visible after selecting the ID value in Document Type combo. The expression can be reused in any other form with the same context in order to manage visibilities, editabilities or mandatory fields, for example.
In the next activity of the process (Register Data from prior policy), the user will reuse the expression because the same collection will be associated to the case in order to create the prior policy, and the same visibility restriction will apply. However, in this case the restriction will apply to the Editability of the field.
The expression previously created will be associated to the Document Number field in the Editability property.
1. Right click on the Document Number field and select Expression for the Editable property.
2. A new window will appear in order to create the expression. To reuse the previously created expression, press Cancel. A new window with the previously created expressions will apear, as well as the Default Expressions. Click on Cancel when the Expression window is displayed.
3. In the previous example, the expression was saved with the ShowNumDoc name. It will appear as an Entity Expression, as shown in the image below.
4. The Document Number field is editable when the Document Type is ID as defined in the expression created in the previous activity and now reused.
<comments />