Validation rules for objects

< Object properties (detailed)

 

The validation rules are used to check if an object meets all of the conditions required before it is saved.

 

Fig. 13.1

To create a new validation rule for an object, first we have to choose one of the two templates:

Fig. 13.2

-          UniqueKey (used the same way the unique key works in SQL)

This kind of rule prevents two records from having identical values in certain properties.

Example:

FSWarehouse (MB_Mag ) : there cannot be two Warehouses with the same Code for the same Company and Department, so from the list of properties we have to choose the Code, Company and Department.

Fig. 13.3

In the validation rule window there is also a section where we can choose from the list of properties, the ones that will trigger the checking of the validation rule when their values are changed.

Fig. 13.4

And finally we have to choose the message Severity and its content.

Fig. 13.5

-          Criteria Operator

This kind of rule is used for more complicated conditions. Here we can add a logical expression.

Example:

FSUsersWorkingTimeConfiguration (MPS_UsersWorkingTimeConfiguration) : This object has two date time properties (EndTime and StartTime). A record of this type is valid if the EndTime is null or the EndTime is greater or equal than the StartTime.

 

To add this rule, we will choose the Criteria Operator template and then add the condition.

 

This rule will be checked when one of those two properties will be changed, so they will have to be selected from the list of properties (Fig. 13.4) and the final step is the validation message (Fig. 13.5).

 

> Validation rules for properties

© 2013 Fluentis Srl. All rights reserved.