---
title: "Understand Quality Inspection Templates and Test Generation Rules"
app: "Quality Inspector"
section: "Set up"
last_updated: "2026-08-25"
url: "https://insight-works.com/kb/quality-inspector/understand-quality-inspection-templates-and-test-generation-rules/"
---

# Understand Quality Inspection Templates and Test Generation Rules

Quality Inspector uses **Quality Inspection Templates** and **Test Generation Rules** together to determine what should be inspected and when an inspection should be performed.

The simplest way to think about the relationship is:

> **A Quality Inspection Template defines what to inspect. A Test Generation Rule defines when to use that template.**

For example, you might create a `RECEIVING` template containing questions about packaging condition, dimensions, and appearance. You can then create a Test Generation Rule that tells Quality Inspector to use the `RECEIVING` template when a particular item or category of items is received.

At a high level, the process is:

**Business Central record → Test Generation Rule → Quality Inspection Template → Quality Inspection Test**

Quality Inspector also uses **Source Configuration** to understand the Business Central record and populate information such as the item, document number, quantity, location, and tracking information on the resulting Quality Inspection Test.

For a more detailed explanation of source relationships, see [Understanding Test Generation Rules and Source Configuration in Quality Inspector](/kb/quality-inspector/understanding-test-generation-rules-and-source-configuration-in-quality-inspector/).

### What is a Quality Inspection Template?

A **Quality Inspection Template** is the test plan that defines the questions, measurements, checks, and other information that an inspector must record.

When a Quality Inspection Test is created, its template determines which inspection fields appear on the test.

For example, a receiving inspection template might contain:

| Inspection field | Example type | Example requirement |
| --- | --- | --- |
| Packaging Condition | Option | GOOD or DAMAGED |
| Width | Decimal | 99.5..100.5 mm |
| Visual Inspection | Option | PASS or FAIL |
| Inspector Comments | Text | Optional notes |

The template can also contain configuration for:

- Default values.
- Grade conditions.
- Instructions.
- Units of measure.
- Sampling.
- AQL inspection levels.
- Calculated fields and expressions.
- First Article Inspection characteristics.
- Attachments and supporting documents.

For a complete description of the available template fields, see [Use Quality Inspection Templates](/kb/quality-inspector/iwxqitemplate-page-al/).

### Quality Inspection Fields versus Template Lines

Before creating a template, it is useful to understand the relationship between **Quality Inspection Fields** and template lines.

A Quality Inspection Field defines a reusable data point such as:

- Width
- Weight
- Temperature
- Packaging Condition
- Color
- Visual Inspection
- Approval
- Comments

The field defines characteristics such as its data type, allowable values, default value, and default grade conditions.

Quality Inspector supports field types including:

- Decimal
- Integer
- Boolean
- Text
- Option
- Table Lookup
- Date
- Date and Time
- Label
- Numeric Expression
- Text Expression
- Signature

For example, a `WIDTH` field might be configured as a **Decimal** field. Its allowable values might permit any technically possible value from `0..500`.

When you add `WIDTH` to a particular template, the template line can then define the requirements that apply to that specific inspection.

This lets the same Quality Inspection Field be reused across several inspection templates without requiring every template to use the same acceptance criteria.

See [Quality Inspection Fields](/kb/quality-inspector/iwxqifields-page-al/) for the available field types and configuration options.

### Allowable values are different from passing values

An important distinction when designing inspection fields is the difference between **Allowable Values** and grade conditions.

**Allowable Values** control what the inspector is permitted to enter.

For example:

`0..100`

allows an inspector to enter any value between 0 and 100.

This does not mean that every value from 0 through 100 passes the inspection.

The passing condition is defined using the appropriate **grade condition**.

For example:

- Allowable Values: `0..100`
- PASS condition: `45..55`

The inspector can therefore record an actual measurement of 46, but Quality Inspector can evaluate that measurement as failing the PASS condition since it would be between 45 and 55. A value of 42 would still be allowed to be entered, but would be categorized as a fail.  A value of 101 or -1 would not be possible to input however, since those would not be within the range of allowable values.

See [Quality Inspection Fields](/kb/quality-inspector/iwxqifields-page-al/) for additional examples of allowable values and grade conditions.

## Build your first Quality Inspection Template

The following example creates a simple receiving inspection template. It is intentionally simple so you can confirm that templates, fields, grading, and generation rules are working before adding more advanced configuration.

Before beginning, ensure that the **Quality Inspector Assisted Setup Wizard** has been completed.

For a broader implementation sequence, see [**Set Up and Configure Quality Inspector**](/kb/quality-inspector/set-up-and-configure-quality-inspector/).

### Step 1: Decide what you want to inspect

For this example, assume that incoming material requires two checks:

1. The packaging must be in acceptable condition.
2. The width of the product must be between 99.5 mm and 100.5 mm.

We will create a template named:

**RECEIVING**

with two fields:

- `PACKAGING`
- `WIDTH`

### Step 2: Create the Packaging Condition field

Navigate to **Quality Inspection Fields** in Business Central.

Create a new field with values similar to:

| Field | Value |
| --- | --- |
| Code | PACKAGING |
| Description | Packaging Condition |
| Field Type | Option |
| Allowable Values | GOOD\|DAMAGED |

Configure the applicable PASS grade condition so that `GOOD` represents an acceptable result.

If the field might be reused by several receiving templates, define the common behavior on the Quality Inspection Field. You can override conditions later on individual templates when necessary.

### Step 3: Create the Width field

Create another Quality Inspection Field:

| Field | Value |
| --- | --- |
| Code | WIDTH |
| Description | Width |
| Field Type | Decimal |
| Allowable Values | A range appropriate for the possible measurements |
| Unit of Measure | mm |

Configure the PASS grade condition as:

`99.5..100.5`

The **Unit of Measure** is informational. Quality Inspector does not automatically convert measurements entered using different units.

You can also create fields while editing a template by using the **Add Field(s) To This Template** action. The Quality Inspector Field Wizard can create new fields and add existing fields without requiring you to leave the template.

### Step 4: Create the template

Navigate to **Quality Inspection Templates**.

Select **New** and configure:

| Field | Example |
| --- | --- |
| Code | RECEIVING |
| Description | Incoming Material Inspection |
| Template Type | General |

For this basic example, leave the template-specific number series, caption expression, AQL settings, and other advanced settings at their defaults unless your implementation requires them.

The template itself does not determine which items use the inspection. That is handled later by a Test Generation Rule.

### Step 5: Add fields to the template

In the **Lines** section of the Quality Inspection Template, select **Add Field(s) To This Template**.

Use the **Quality Inspector Field Wizard** to add:

1. `PACKAGING`
2. `WIDTH`

The template now represents the inspection that the quality inspector will perform.

When a Quality Inspection Test is created from this template, its inspection lines will contain the Packaging Condition and Width fields.

Review the grade conditions on each template line and adjust them if the requirements for this particular template differ from the defaults defined on the Quality Inspection Field.

For more information about template configuration, see [Use Quality Inspection Templates](/kb/quality-inspector/iwxqitemplate-page-al/).

### Step 6: Test the template manually

Before automating the inspection, it is often useful to test the template by itself.

From the **Quality Inspection Templates** page:

1. Select the `RECEIVING` template.
2. Select **Create Test**.
3. Record values for the inspection fields.
4. Verify that the expected grades are calculated.
5. Test both passing and failing values.

A generation rule must exist for the template before creating a test from the template using this action.

Testing the template separately helps distinguish a problem with the inspection design from a problem with automatic test creation.

## What is a Test Generation Rule?

Once the template defines **what** to inspect, a **Quality Inspection Test Generation Rule** determines **when that template applies**.

A Test Generation Rule connects:

- A Quality Inspection Template.
- A Business Central source table.
- Optional conditions or filters.
- Manual or automatic activation behavior.
- An automatic creation trigger for supported Business Central processes.

For example:

> Use the `RECEIVING` template for Purchase Lines where Item No. = 1000.

Or:

> Use the `RECEIVING` template whenever an item belonging to the RAW MATERIAL item category is received.

Test Generation Rules answer the question:

> **Which inspection should I perform for this Business Central record?**

They do not determine how fields such as Document No., Item No., Quantity, or Variant Code are copied into the resulting Quality Inspection Test. That behavior is controlled by **Source Configuration**.

See [Understanding Test Generation Rules and Source Configuration in Quality Inspector](/kb/quality-inspector/understanding-test-generation-rules-and-source-configuration-in-quality-inspector/) for more information.

### Step 7: Create a Test Generation Rule

For a receiving inspection, the easiest approach is normally to use the **Create Receiving Rule** wizard.

Navigate to **Quality Inspection Test Generation Rules** and select **Create Receiving Rule**.

The wizard lets you:

1. Select the Quality Inspection Template.
2. Choose the type of receiving transaction.
3. Define filters such as location, vendor, or purchasing information.
4. Define item-related filters.
5. Configure the appropriate automatic creation behavior.

For our example, select the `RECEIVING` template and configure the rule so that it applies to a controlled test item.

For more detailed procedures, see:

- [Create a Receiving Rule in Quality Inspector](/kb/quality-inspector/create-receiving-rule-wizard-in-quality-inspector/)
- [Create a Test Generation Rule for a Specific Item in Quality Inspector](/kb/quality-inspector/create-a-test-generation-rule-for-a-specific-item-in-quality-inspector/)
- [Create a Test Generation Rule for a Category of Items in Quality Inspector](/kb/quality-inspector/create-a-test-generation-rule-for-a-category-of-items-in-quality-inspector/)

### Template versus generation rule filters

Do not create a separate template simply because different items require the same inspection.

For example, suppose items 1000, 1001, and 1002 all require:

- Packaging inspection.
- Width measurement.
- Visual inspection.

You can normally use one `RECEIVING` template and use Test Generation Rules to decide which items receive that inspection.

Create a separate template when **what you inspect is different**.

Create or change a Test Generation Rule when **when or where the inspection applies is different**.

For example:

| Requirement | Usually change |
| --- | --- |
| Item 1000 needs a different measurement | Template |
| Only Item Category RAW should receive the inspection | Generation Rule |
| Vendor A requires a special inspection | Generation Rule and possibly another template |
| Add a packaging question to every receiving inspection | Template |
| Apply the existing inspection at another location | Generation Rule |
| Use a different tolerance for a particular inspection | Template/template line |
| Automatically create the inspection when receiving | Generation Rule trigger |

## How Source Configuration fits in

For most standard receiving and production implementations, you do not need to create Source Configuration manually.

The **Quality Inspector Setup Wizard** creates Source Configurations required for many standard Business Central processes.

Source Configuration tells Quality Inspector how to understand the source record and populate information on the test.

For example:

**Purchase Line → Quality Inspection Test**

might map:

| Purchase Line | Quality Inspection Test |
| --- | --- |
| Document No. | Source Document No. |
| Line No. | Source Document Line No. |
| No. | Source Item No. |
| Variant Code | Source Variant Code |
| Quantity | Source Quantity |

Source Configuration can also connect related Business Central records.

For example:

**Warehouse Receipt Line → Purchase Line → Quality Inspection Test**

This lets Quality Inspector begin with the warehouse record that caused the inspection process to run while still retrieving purchasing information from the related Purchase Line.

A useful distinction is:

> **Generation Rule = Should this inspection be used?**

> **Source Configuration = How does Quality Inspector understand this Business Central record?**

For common Business Central scenarios, use the standard Source Configuration wherever possible. Custom Source Configuration is normally required when integrating with a custom table or when additional related information must be made available to Quality Inspector.

See [Understanding Test Generation Rules and Source Configuration in Quality Inspector](/kb/quality-inspector/understanding-test-generation-rules-and-source-configuration-in-quality-inspector/) for detailed examples.

## Understand automatic triggers

A matching Test Generation Rule does not necessarily mean that Quality Inspector will automatically create a test.

The rule also controls how the inspection can be activated and, for supported processes, which event should automatically create it.

Depending on the scenario, Quality Inspector can create inspections from processes such as:

- Purchase receiving.
- Warehouse receiving.
- Production output.
- Assembly output.
- Warehouse movement.
- Transfers.
- Sales returns.
- Scheduled inspection processes.

For example:

- Create a Quality Inspection Template of RECEIVING
- Create a Quality Inspection Test Generation Rule for a Purchase Line where Item Category = RAW MATERIAL
- Set the automatic trigger on the Quality Inspection Test Generation rule for when the receipt is posted (the setting on the Quality Inspector Setup page only defines the default for new Quality Inspection Test Generation Rules).
- The result would be:

   - When qualifying raw material is received, Quality Inspector automatically creates a `RECEIVING` Quality Inspection Test document.
   - The template itself does not cause this automation. It supplies the inspection plan used when the generation rule and trigger determine that a test document should be created.

## Avoid overlapping Test Generation Rules

More than one Test Generation Rule can potentially match the same Business Central record.

When multiple rules apply, Quality Inspector evaluates them based on their configured **Sort Order** and uses the first applicable template.

For that reason, avoid unnecessarily overlapping generation rules.

For example, consider these rules:

| Sort Order | Rule |
| --- | --- |
| 10 | Item No. = 1000 → SPECIAL RECEIVING |
| 20 | Item Category = RAW MATERIAL → RECEIVING |
| 30 | All Purchase Lines → BASIC RECEIVING |

Item 1000 might satisfy all three conditions.

The sort order determines which applicable template is selected.

A useful design approach is to place:

1. Specific exceptions first.
2. More general category or group rules next.
3. Broad/default rules last.

Review the interactions whenever adding a new rule to an implementation that already contains generation rules.

## Reuse templates when possible

Templates are easier to maintain when they represent meaningful inspection plans rather than individual records.

Instead of creating:

- ITEM1000 RECEIVING
- ITEM1001 RECEIVING
- ITEM1002 RECEIVING

consider whether all three can use:

- RECEIVING

with Test Generation Rules determining when the template applies.

Create separate templates when the actual questions, measurements, tolerances, sampling requirements, or instructions differ enough to represent a different inspection process.

For complex dimensional inspection plans, Quality Inspector also supports techniques such as reusable fields, template copying, specification lookups, expressions, and specialized Balloon/Bubble templates.

See [Designing Large Dimensional Inspection Plans in Quality Inspector](/kb/quality-inspector/designing-large-dimensional-inspection-plans-in-quality-inspector/) for considerations when managing larger inspection plans.

## Validate the complete configuration

After configuring the template and generation rule, test the complete process.

For a receiving example:

1. Create a purchase order for an item that satisfies the Test Generation Rule.
2. Enter a quantity to receive.
3. Release the purchase order.
4. Post the receipt using the Business Central process configured for the rule.
5. Confirm that a Quality Inspection Test is created.
6. Confirm that the `RECEIVING` template was selected.
7. Confirm that the expected source information is populated.
8. Record passing values.
9. Confirm that the expected grade is assigned.
10. Repeat the process using failing values.
11. Test an item that should **not** match the rule and confirm that an unwanted inspection is not created.

If no test is created, review:

- Whether the Test Generation Rule is enabled for the required activation method.
- The source table.
- Condition, item, and attribute filters.
- The automatic trigger.
- Sort order if several rules might apply.

If the test is created but source information such as the item, quantity, or document number is incorrect or missing, investigate **Source Configuration** instead.

## Summary

Quality Inspector separates the definition of an inspection from the circumstances in which it is required.

**Quality Inspection Fields**

Define reusable questions, measurements, and data points.

↓

**Quality Inspection Template**

Defines what the inspector needs to check.

↓

**Test Generation Rule**

Defines which Business Central records should use the template and how the inspection can be triggered.

↓

**Source Configuration**

Defines how Quality Inspector understands the Business Central source record and which information is transferred or related to the test.

↓

**Quality Inspection Test**

Is the actual inspection performed by the user.

Keeping these responsibilities separate allows the same inspection templates to be reused across items, vendors, locations, and Business Central processes while using generation rules to control exactly where each inspection applies.

### Related information

- [Use Quality Inspection Templates](/kb/quality-inspector/iwxqitemplate-page-al/) – Reference for Quality Inspection Template fields, template lines, sampling, and template actions.
- [Quality Inspection Fields](/kb/quality-inspector/iwxqifields-page-al/) – Configure reusable questions, measurements, field types, allowable values, and grade conditions.
- [Understanding Test Generation Rules and Source Configuration in Quality Inspector](/kb/quality-inspector/understanding-test-generation-rules-and-source-configuration-in-quality-inspector/) – Detailed explanation of generation rules, source mapping, chained source configurations, and troubleshooting.
- [Create Quality Inspections for Receipts](/kb/quality-inspector/create-quality-inspections-for-receipts/) – End-to-end receiving example including fields, a template, a generation rule, automation, and validation.
- [Create a Receiving Rule in Quality Inspector](/kb/quality-inspector/create-receiving-rule-wizard-in-quality-inspector/) – Use the Receiving Rule wizard to configure receiving inspections.
- [Create a Test Generation Rule for a Specific Item in Quality Inspector](/kb/quality-inspector/create-a-test-generation-rule-for-a-specific-item-in-quality-inspector/) – Apply a template to a particular item.
- [Create a Test Generation Rule for a Category of Items in Quality Inspector](/kb/quality-inspector/create-a-test-generation-rule-for-a-category-of-items-in-quality-inspector/) – Apply a template to an item category.
- [Create a Production Rule in Quality Inspector](/kb/quality-inspector/create-production-rule-wizard-in-quality-inspector/) – Configure generation rules for production and assembly.
- [Designing Large Dimensional Inspection Plans in Quality Inspector](/kb/quality-inspector/designing-large-dimensional-inspection-plans-in-quality-inspector/) – Design and maintain larger dimensional inspection plans.
