Contract Validation Rules
  • 16 Jul 2024
  • 6 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Contract Validation Rules

  • Dark
    Light
  • PDF

Article summary

Configurable Contract Validation Rules

1. Purpose

Contract Validation Rules purpose is to check Quote, Application or E-Signatures Signers data. To use these configurable rules instead of hardcoded checks field, Use Configurable Leasing Checks in Leasing Setup table must be enabled.
image.png

You can still include hardcoded checks for complicated scenarios by subscribing to OnAfterValidations(Rec, WarningLog) event in codeunit 17021599 "S4LA Contract Validation Run".

It is recommended to import pre-defined standard contract validation rules using configuration packages when you decide switch to configurable data checks.

2. Contract Validation Rule

2.1 General

To create validation rules all fields values in this area must be populated.
image.png
Description is the description of a rule.
Applies To defines the scope (scenario) when the rule is triggered. Choose one or multiple validation rule scopes from list.
image.png
Checking Table ID and Table Names specifies the table that records or field value you need to check.
Checking Record Filters specifies filters for checking table records. You must select fields and values to filter the record by (refer to 2.2 Checking Record Filter for more details).
Related Records Filters specify filters for related records that are required in checks. These filters help do define checking scenarios when checking record filtering is not sufficient and requires additional tables to be involved (refer to 2.3 Related Records Filters for more details).
Check Level specifies the level of checking, is it the record itself or a field in the record.
Field No. and Field Name specifies field that value is being checked.
Check Condition specifies checking record or field check condition.
Check Value Relation is required when you need to check field against another field on Contract, Schedule, or Rule Primary Record (checking record).
Check Value specifies value that the checking field value must match according to the specified condition. Check Value can only be entered manually when Check Value Relation is empty, otherwise you need to select the field from related table.
Check Failure Message Text specifies the message which will be displayed if validation fails. To get Field value from checking table, Field Name must be defined in curly brackets and enclosed in double quote (e.g. {“Name”}). To include Field value from Contract or Schedule input relative table name and dot character before Field name (e.g. {Contract.“Name”}). If values from checking or check value fields are required, numbered specifiers can be used in text, which will be replaced be replaced as follows: %1 - Field Value, %2 - Check Value, %3 - Field Caption, %4 - Check Value Caption.
Severity specifies severity level. It can be Info, Warning or Critical. Use Warning Log Colour setup to define colors for every level.
Processing Order specifies the ordering in which the validation rules are processed.
Enabled specifies if the rule is active or not. Not Enabled rule are skipped and not verified.

2.2 Checking Record Filters

Checking record filters must be filled to get the proper record for check. If no records are found after filtering, the rule will be skipped. It could be used for initial checking by filtering records with invalid data only (check for invalid records existence).
image.png
Field ID, Field Name and Field Caption defines the field you want to filter in the checking table.
Select Filter Field Relation if the record should be filtered by another field in the related table (contract, schedule or checking table).
Field Filter specifies field's filter value for a checking record. Only the records under this filter are included in the validation rule run.

2.3 Related Records Filters

Related records filters are used to check additional conditions. If no records are found after filtering, the rule will be skipped.
image.png
Related Tables (All) specifies a list of all related tables included in current filter below.
Table Name and Table ID specifies the related table. After you select a table from the list of tables, the Table Name is automatically filled in.
Field ID, Field Name and Field Caption specify the field you want to filter.
Select Filter Field Relation if the record should be filtered by another field in the related table (contract, schedule or checking table).
Field Filter specifies field's filter value for a checking record. Only the records under this filter are included in the validation rule run.

3. Actions on the pages

Action Run Rule Test on rule card page runs current rule regardless of whether it is enabled or not.
image.png
Action Run Rules Test on rule list page runs all enabled rules (Applies To Filter is evaluated as well).
image.png
Action Copy Validation Rule will copy selected rule with all related filters and fields except Description.

4. Sample rules

4.1 Check Nationality is not empty for not primary Sole Trader or Partnership Applicant

This is an example of the rule to check* if applicant nationality is assigned when applicant is sole trader or partnership and is not a primary applicant.*
image.png
The rule is applied to Submit for Approval and Compliance scopes. Applicant table (No. = 17021562) is selected for checking.
image.png
To filter required Applicant records, the relevant fields are selected in the record filters. First entry's (Field Name = Contract No.) field “Filter Field Relation” is used to filter Applicants for the current Contract (without this filter rule would scan through all Applicants in the system). In other entries various fields of the Applicant table are filtered by applying fixed filters. If no records are found by applying the filters current rule will be skipped.
image.png
To check condition whether Applicant is Sole Trader or Partnership you need to use Related Records Filters and check what Legal form is assigned for every Applicant. If no records are found after filtering, current rule will be skipped.
image.png
Rule’s Check Level and Field No. fields are configured to check Nationality field on Applicant table. To check if this field value is not empty Not Blank value in Check Condition field is selected. Another options are: Blank, Equal, Not Equal, More, Less, Not Less, Not More. If Check Condition value is comparative (e.g., Equal, More), field Check Value must be populated as well. Field Check Value Relation must be populated if you need to compare checking field value with another table field.
When selected field value does not match Check Condition, an error message with text from Check Failure Message Text field and severity level defined in Severity field is written to Warning Log.
Only Enabled rules are processed but you can run test for not enabled rule to verify rules’ correctness.

4.2 Check Approval Conditions if not Disabled Approval Conditions Verification

This is an example of the rule to check that all required approval conditions are met if approval conditions verification is not disabled ON financial product.
image.png
The rule is applied to Compliance scope only. “Approval Conditions” table (No. = 17021562) is selected for checking.
image.png
To filter required Approval Conditions records, the relevant fields are selected in the record filters. First entry's (Field Name = Contract No.) field “Filter Field Relation” is used to filter Approval Conditions for the current Contract (without this filter rule would scan through all Approval Conditions in the system). In other entries various fields of the Approval Conditions table are filtered by applying fixed filters. If no records are found by applying the filters current rule will be skipped.
image.png
To check condition whether Approval Conditions are enabled on “Financial Product” you need to use Related Records Filters and check what “Financial Product” is assigned for every Contract. If no records are found after filtering, current rule will be skipped.
image.png
Rule’s Check Level value is Record because we want to check if there are existing Approval Conditions records that are required and are not complied ats the same time. To check if there are no such records Blank value in Check Condition field is selected. If Check Level value is a record and comparative Check Condition is selected, then you can input Check Value. Only Integer data type values are accepted to verify the number of filtered records.
When selected field value does not match Check Condition, an error message with text from Check Failure Message Text field and severity level defined in Severity field is written to Warning Log.
Only Enabled rules are processed but you can run test for not enabled rule to verify rules’ correctness.


Was this article helpful?