Automate Test Creation when Posting a Purchase Receipt with Warehouse Handling

Skip to main content

Automate Test Creation when Posting a Purchase Receipt with Warehouse Handling

You are here:

This walkthrough goes through a scenario of having a quality inspection test created automatically when posting a purchase receipt in a location with warehouse handling.

This walkthrough uses the standard Contoso data available in a demo Business Central 25 install.

Prerequisites

  • Use a “Contoso” company as a baseline with the “WHITE” location and the “WRB-1002” item, and vendor “40000”.
  • Prerequisite: Ensure the Assisted Setup Wizard was run.
  • Prerequisite: If any previous test cases were followed then set the Activation Trigger to “Disabled” on all existing test generation rules.
  • Prerequisite: On the Quality Inspection Setup have “Show Test ” set to “Automatic and Manually Created Tests”.

1. Add a new field to the Quality Inspection Template

  1. Navigate to Quality Inspection Templates in Business Central.
  2. Select +New.
  3. Input a unique, unused code in the Code field (e.g., “MYEXAMPLE”).
  4. Input a description for the template in the Description field (e.g., “MYEXAMPLE WHSE REC”).
  5. Select Add Field(s) To This Template in the action bar section (Quality Inspection Field Wizard start).
  6. Select New Field and select Next.
  7. Input a unique, unused description (e.g., “MYFIELD1”) and tab off the field (short name (Field Code) and What type of data is it fields appear).
  8. Leave the Short name (Field Code) field unchanged.
  9. Select “A number” in the What type of data is it field.
  10. Select Next (the next page describes Number Field Details field and fields that allow defining the default value, allowed values, and pass values).
  11. Locate the Set the range of allowed values field and set the following fields:
    • Minimum: 5 (the minimum allowed value to be entered, not the pass value).
    • Maximum: 50 (the maximum allowed value to be entered, not the pass value).
  12. Locate the Field Conditions section and set the following fields:
    • Pass Min: 10 (minimum allowed value to be considered a Pass).
    • Pass Max: 20 (maximum allowed value to be considered a Pass).
  13. Select Finish.

The Quality Inspection Field Wizard closes, and the new field is added to the Quality Inspection Template.

2. Create a test generation rule

  1. Select Test Generation Rules (opens the Quality Inspection Test Generation Rules page and filters to the above template).
  2. Select Create Receiving Rule.
  3. Select the template you created in the Select Template
  4. Enable “Purchase Line” in the What kind of receiving rule are you making
  5. Select Next.
  6. Select “WHITE” in the Location field and select Next.
  7. Select “WRB-1002” in the Specific Item field and select Next.
  1. Select Finish.

After the wizard closes a test generation rule will have been made.

3. Modify the Test Generation Rule and create a Purchase Order

Locate the newly created Test Generation Rule record on the Quality Inspection Test Generation Rules page.

  1. Select “Manual or Automatic” in the Activation Trigger field.
  2. Select “When Purchase Order is Received” in the Purchase Trigger field.
  3. Close the following pages:
    1. Test Generation Rules
    2. Quality Inspection Template
    3. Quality Inspection Templates
  4. Navigate to Purchase Orders and select +New.
  5. Select “40000” In the Vendor No. field and tab off the field.
  6. Navigate to the first row in the Lines subpage and ensure the Type column is showing “Item”.
  7. Input “WRB-1002” into the field and tab off the field.
  8. Select “WHITE” in the Location Code field.
  9. Input “123” into the Quantity field, ensure the Unit of Measure Code is set to the item’s base unit of measure, and tab off the field.
  10. Select “Release” in the action bar area.
  11. Select “Create Whse. Receipt” in the action bar area.
  12. Navigate to the Lines section and select the line for the WRB-1002 item.
  13. Select “Item Tracking Lines” in the Line menu (opens the Item Tracking Lines page).
  14. Input a unique unused lot number such as “WRB1002-2025-07-24-001” into the Lot No. column and tab off the column.
  1. Input “123” into the Quantity (base) column and tab off the column.
  2. Select any future date in the Expiration Date field.
  3. Select Close.
  4. Select Post Receipt in the action bar.
  5. Select Yes if asked “Do you want to post the receipt?”

4. Quality Inspection Test/Order

After completing the above sections, a Quality Inspection Test/Order displays the following fields:

  • Quantity (base): Set to “123”
  • Status: Set to “Open”
  • Item No.: Set to “WRB-1002”
  • Lot No.: Set to “WRB1002-2025-07-24-001”
  • Template Code: Set to the template configured in the earlier steps.
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Need help?

Leave A Comment

Table of Contents
Go to Top