---
id: post/yzhums-com/69444
type: post
title: "Dynamics 365 Business Central: How to check whether External Document No./Vendor Invoice No. are unique or duplicated – Customization"
summary: Developers can add customization to validate whether External Document No. and Vendor Invoice No. are unique or duplicated across both pre-posting and posted documents in Business Central, since the system does not perform this validation by default.
tier: community
language: en
tags:
  - customization
  - validation
  - external document numbers
  - data integrity
  - duplicate checking
system: sales
review:
  state: reviewed
  by: opus
  at: "2026-10-26T06:41:18.698Z"
  flags: []
generated:
  at: "2026-10-26T05:51:10.938Z"
  pipeline: 0.2.0
  prompts:
    extract-post: 1
  input_hash: 0e32af108bfe54a779fef92ca49653e468e7916ee543cc33c2fbbfa8e5fc203a
evidence:
  - kind: blog
    url: https://yzhums.com/69444/
    title: "Dynamics 365 Business Central: How to check whether External Document No./Vendor Invoice No. are unique or duplicated – Customization"
    date: "2025-12-18"
    commit: null
    t: null
    quote: null
  - kind: blog
    url: https://yzhums.com/69444/
    title: "Dynamics 365 Business Central: How to check whether External Document No./Vendor Invoice No. are unique or duplicated – Customization"
    date: "2025-12-18"
    commit: null
    t: null
    quote: Business Central does not validate whether external document numbers are unique or duplicated.
  - kind: blog
    url: https://yzhums.com/69444/
    title: "Dynamics 365 Business Central: How to check whether External Document No./Vendor Invoice No. are unique or duplicated – Customization"
    date: "2025-12-18"
    commit: null
    t: null
    quote: If this kind of control is required, a small customization is necessary.
links:
  learn: []
  objects:
    - object/table/36
    - object/table/112
    - object/table/38
    - object/table/122
    - object/table/311
    - object/table/312
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  related:
    - to: post/gerardorenteria-blog/15143
      title: 🧩 Deriving dimensions in Business Central beyond Default Dimensions
      label: possibly related
      why: both name Table 112 "Sales Invoice Header"
      by: code
    - to: post/mohana-blog/tag-blogger-com-1999-blog-1492436440038408053-post-483274250682537951--01a78739b7
      title: BC 29 lets a single index span base table and table extension fields
      label: possibly related
      why: both name Table 112 "Sales Invoice Header"
      by: code
    - to: post/thatnavguy-com/https-thatnavguy-com-blog-2025-bc-friday-tips-56-understand-missing-fields-in-copy-documents--e98f782aea
      title: "BC Friday Tips #56 Understand Missing Fields in Copy Documents"
      label: possibly related
      why: both name Table 112 "Sales Invoice Header"
      by: code
    - to: post/thatnavguy-com/https-thatnavguy-com-blog-2026-bc-friday-tips-74-copy-document--70de705561
      title: "BC Friday Tips #74 Copy Document and Custom Field"
      label: possibly related
      why: both name Table 112 "Sales Invoice Header"
      by: code
    - to: post/thatnavguy-com/https-thatnavguy-com-blog-2025-d365-business-central-how-to-fix-missing-sales-invoices-in-the-api--9b9a0831d9
      title: "D365 Business Central: How to Fix Missing Sales Invoices in the API"
      label: possibly related
      why: both name Table 112 "Sales Invoice Header"
      by: code
    - to: post/bertverbeek-nl/1162
      title: Document amount on Purchase Invoice Header
      label: possibly related
      why: both name Table 312 "Purchases & Payables Setup"
      by: code
    - to: post/yzhums-com/64609
      title: "Dynamics 365 Business Central: “Hide Company Bank Account” setup in General Ledger Setup (Update Company Bank Account on posted documents)"
      label: possibly related
      why: both name Table 112 "Sales Invoice Header"
      by: code
    - to: post/yzhums-com/64874
      title: "Dynamics 365 Business Central: Copy Sales and Purchase Line Descriptions (Type G/L Account) to G/L Entries"
      label: possibly related
      why: both name Table 312 "Purchases & Payables Setup"
      by: code
    - to: post/yzhums-com/75131
      title: "Dynamics 365 Business Central: Displaying Sales/Purchase Order No. in Item Ledger Entries (Source Order No. and Source Description)"
      label: possibly related
      why: both name Table 112 "Sales Invoice Header"
      by: code
    - to: post/yzhums-com/70415
      title: "Dynamics 365 Business Central: How to run a Report in Preview Mode without the Request Page (Hide Request Page)"
      label: possibly related
      why: both name Table 112 "Sales Invoice Header"
      by: code
post_id: "69444"
source_id: yzhums-com
source_name: Dynamics 365 Lab - Yun Zhu
url: https://yzhums.com/69444/
published_at: "2025-12-18T02:24:23.000Z"
author: Yun Zhu
full_text: false
words: 607
quotes:
  - text: Business Central does not validate whether external document numbers are unique or duplicated.
    why_it_matters: Explains the gap that requires custom solution.
  - text: If this kind of control is required, a small customization is necessary.
    why_it_matters: Justifies the need for the codeunit-based approach.
code_objects_mentioned:
  - table Sales Header
  - table Sales Invoice Header
  - table Purchase Header
  - table Purch. Inv. Header
  - table Sales & Receivables Setup
  - table Purchases & Payables Setup
  - codeunit ExtDocNoHandler
systems:
  - sales
  - purchasing
  - development
versions_mentioned: []
preview:
  embeddable: true
  frame_url: null
  image: https://yzhums.com/wp-content/uploads/2025/12/Snipaste_2025-12-17_18-23-28.png
  image_alt: null
  image_w: null
  image_h: null
  site_name: Dynamics 365 Lab
  favicon: https://yzhums.com/wp-content/uploads/2020/08/cropped-logo-3-32x32.png
  probed_at: "2026-10-26T06:11:04.601Z"
---

# Dynamics 365 Business Central: How to check whether External Document No./Vendor Invoice No. are unique or duplicated – Customization

[Read the post](https://yzhums.com/69444/) · Dynamics 365 Lab - Yun Zhu (Yun Zhu, MVP) · 2025-12-18 · 607 words · tier community · reviewed (checked by Opus)

> Developers can add customization to validate whether External Document No. and Vendor Invoice No. are unique or duplicated across both pre-posting and posted documents in Business Central, since the system does not perform this validation by default.

## Key points

- Business Central allows external document numbers on sales and purchase orders, invoices, and credit memos, but doesn't validate uniqueness by default.
- A codeunit with event subscribers on Sales Header and Purchase Header tables can check for duplicate numbers in both draft and posted documents.
- The solution includes a setup flag in Sales & Receivables Setup and Purchases & Payables Setup to optionally allow duplicates.
- Validation can be scoped to specific document types or check across all documents as needed.

## Quotes

- "Business Central does not validate whether external document numbers are unique or duplicated." (Explains the gap that requires custom solution.)
- "If this kind of control is required, a small customization is necessary." (Justifies the need for the codeunit-based approach.)

## AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

- [table 36 "Sales Header"](../../objects/table/36.md)
- [table 112 "Sales Invoice Header"](../../objects/table/112.md)
- [table 38 "Purchase Header"](../../objects/table/38.md)
- [table 122 "Purch. Inv. Header"](../../objects/table/122.md)
- [table 311 "Sales & Receivables Setup"](../../objects/table/311.md)
- [table 312 "Purchases & Payables Setup"](../../objects/table/312.md)
- codeunit "ExtDocNoHandler"

Not found in BC28-30: codeunit "ExtDocNoHandler".

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [🧩 Deriving dimensions in Business Central beyond Default Dimensions](../../posts/gerardorenteria-blog/15143.md) — possibly related: both name Table 112 "Sales Invoice Header"
- [BC 29 lets a single index span base table and table extension fields](../../posts/mohana-blog/tag-blogger-com-1999-blog-1492436440038408053-post-483274250682537951--01a78739b7.md) — possibly related: both name Table 112 "Sales Invoice Header"
- [BC Friday Tips #56 Understand Missing Fields in Copy Documents](../../posts/thatnavguy-com/https-thatnavguy-com-blog-2025-bc-friday-tips-56-understand-missing-fields-in-copy-documents--e98f782aea.md) — possibly related: both name Table 112 "Sales Invoice Header"
- [BC Friday Tips #74 Copy Document and Custom Field](../../posts/thatnavguy-com/https-thatnavguy-com-blog-2026-bc-friday-tips-74-copy-document--70de705561.md) — possibly related: both name Table 112 "Sales Invoice Header"
- [D365 Business Central: How to Fix Missing Sales Invoices in the API](../../posts/thatnavguy-com/https-thatnavguy-com-blog-2025-d365-business-central-how-to-fix-missing-sales-invoices-in-the-api--9b9a0831d9.md) — possibly related: both name Table 112 "Sales Invoice Header"
- [Document amount on Purchase Invoice Header](../../posts/bertverbeek-nl/1162.md) — possibly related: both name Table 312 "Purchases & Payables Setup"
- [Dynamics 365 Business Central: “Hide Company Bank Account” setup in General Ledger Setup (Update Company Bank Account on posted documents)](../../posts/yzhums-com/64609.md) — possibly related: both name Table 112 "Sales Invoice Header"
- [Dynamics 365 Business Central: Copy Sales and Purchase Line Descriptions (Type G/L Account) to G/L Entries](../../posts/yzhums-com/64874.md) — possibly related: both name Table 312 "Purchases & Payables Setup"
- [Dynamics 365 Business Central: Displaying Sales/Purchase Order No. in Item Ledger Entries (Source Order No. and Source Description)](../../posts/yzhums-com/75131.md) — possibly related: both name Table 112 "Sales Invoice Header"
- [Dynamics 365 Business Central: How to run a Report in Preview Mode without the Request Page (Hide Request Page)](../../posts/yzhums-com/70415.md) — possibly related: both name Table 112 "Sales Invoice Header"

## Context

- Features: external document number validation, duplicate detection, pre-posting validation, posted document checking, setup-based control, sales order validation, purchase order validation

Source: Dynamics 365 Lab - Yun Zhu, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.
