--- title: "Set up validation rule of type Custom" slug: "set-up-validation-rule-of-type-custom" description: "Learn to set up custom validation rules for data quality management, ensuring your data meets defined standards with effective validation techniques." tags: ["Task topic"] updated: 2026-03-20T11:31:29Z published: 2026-03-20T17:44:40Z canonical: "docs.staedean.com/set-up-validation-rule-of-type-custom" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.staedean.com/llms.txt > Use this file to discover all available pages before exploring further. # Set up validation rule of type Custom Use validation rules to check if the data is in line with the defined standards. To validate data, you can use several validation types. This topic explains how to set up a validation rule of type **Custom**. Use a custom validation rule to validate a field value using a custom validation class. Before you can set up a custom validation rule, ensure that the custom validation class is developed. You can add validation rules in these ways: - Manually. - Select the fields to be validated from a page. ### Steps 1. Click **Data quality management**. 2. On the **Data quality policies** tab, in the list, click the link of the desired data quality policy. > [!NOTE] > Note > > If you want to edit another data quality policy version than the currently shown version, first select the desired version. To do so, on the **Action Pane**, on the **Version** tab, click **Versions**. On the dialog, select the desired version and click **OK**. 3. Sub-task: Manually create validation rule. 1. You can manually create a validation rule and define the table and field which value must be validated. On the **Validation rules** tab, click **Add**. 2. Define the table of the field which value must be validated. In the **Table** field, enter or select a value. > [!NOTE] > Note > > If you want to validate field values in inherited tables, define the child table instead of the base table. For example, instead of **DirPartyTable**, use **DirOrganization** or **DirPerson**. 3. Define the field which value must be validated. In the **Field** field, enter or select a value. 4. Sub-task: Create validation rules by selecting fields. 1. You can create validation rules by selecting the fields, which value must be validated, from a page. On the **Validation rules** tab, click **Select** fields. 2. Open the page from which you want to select fields. 3. On the **Field picker** dialog, click **Select** fields. 4. Click the **'+'** button for each field that you want to select. 5. On the **Field picker** dialog, click **Done**. 6. On the **Field picker** dialog, click **Submit** to save the selected fields to the validation rule. 5. Define to which records the validation rule is applied. You can apply a validation rule to: In the **Record type** field, select an option. - New records only. - Existing records only. - New records and existing records. 6. In the **Validation type** field, select **'Custom**'. 7. Define when the validation rule is applied: In the **Event** field, select an option. - **Field**: The validation rule is applied just before the standard field validation is done. - **Record**: The validation rule is applied just before the standard record validation is done. 8. Define what is done if the validation rule is not met: In the **Outcome** field, select an option. > [!NOTE] > Note > > For each validation rule, you can define a message to be shown. If you do not define a validation rule message, a default message is shown. - **Warning**: A warning message is shown. The record or the field value is saved. - **Error**: An error message is shown. The record or the field value is not saved. 9. Sub-task: Set the validation rule properties. 1. Define the custom validation class to be applied for the validation rule. On the **Properties** tab, in the **Class name** field, enter or select a value. > [!NOTE] > Note > > You can only select classes that extend the **DQSCustomValidationBase** base class. 10. Close the page. > [!NOTE] > Notes > > Several validation rule tutorial classes are provided with the Data Quality Studio. These tutorial classes serve as an example of custom classes for a custom validation rule and are not supported. You can customize the tutorial class as desired. If you want to do so, you are advised to create a copy of the tutorial class and make the changes in the copy. | Tutorial class | Description | | --- | --- | | DQTCustomValidation_GS1checksum | This tutorial class checks if the length of an entered bar code is according to the [GS1 bar code standards](https://www.gs1.org/standards). To do this, the [check digit](https://www.gs1.org/services/how-calculate-check-digit-manually) is considered. An entered bar code is valid if it matches one of the GS1 bar code standards, as defined in the tutorial class. > [!NOTE] > **Note** > > The length of an entered bar code is checked against several GS1 bar code standard lengths, as defined in the tutorial class. If desired, you can customize the class, for example, to remove standard lengths you do not use. | | DQTCustomValidation_OrderAccountChange | For sales orders and purchase orders, you can change the customer account, vendor account, or invoice account. However, if already journals are posted for an order, it is often not desired to have an account changed. For the: - SalesTable, you can set up a custom validation rule to validate the customer account or invoice account. - PurchTable, you can set up a custom validation rule to validate the vendor account or invoice account. On entering or changing the applicable account number on the applicable order, this tutorial class checks: 1. Does a posted confirmation journal, packing slip journal, or invoice journal exist for the order? 2. If so, does the account number, as entered or changed for the order, match the account number on the posted journal? If the entered account number does not match the account number on the posted journal, an error or warning message is shown. | ## Related - [Set up validation rule of type Custom](/set-up-validation-rule-of-type-custom-flow.md)