---
id: post/yzhums-com/74940
type: post
title: Dynamics 365 Business Central: Searches for duplicate external document numbers in sales documents and posted documents (Standard function/procedure)
summary: Business Central provides a standard method to search for duplicate external document numbers in sales documents and posted documents. The SearchForExternalDocNo procedure in codeunit 1302 validates duplicates for the same customer, though it only checks within individual customer records rather than across all customers.
tier: community
language: en
tags:
  - external document numbers
  - duplicate validation
  - sales documents
  - standard functions
  - customization
system: sales
review:
  state: reviewed
  by: opus
  at: "2026-10-26T06:39:39.111Z"
  flags: []
generated:
  at: "2026-10-26T05:51:10.938Z"
  pipeline: 0.2.0
  prompts:
    extract-post: 1
  input_hash: f9365541be1eb4d6f694befd5197322636e4ff32fa7779cd2c7802fcbe697964
evidence:
  - kind: blog
    url: https://yzhums.com/74940/
    title: Dynamics 365 Business Central: Searches for duplicate external document numbers in sales documents and posted documents (Standard function/procedure)
    date: "2026-07-24"
    commit: null
    t: null
    quote: null
  - kind: blog
    url: https://yzhums.com/74940/
    title: Dynamics 365 Business Central: Searches for duplicate external document numbers in sales documents and posted documents (Standard function/procedure)
    date: "2026-07-24"
    commit: null
    t: null
    quote: Business Central does not validate whether external document numbers are unique or duplicated.
  - kind: blog
    url: https://yzhums.com/74940/
    title: Dynamics 365 Business Central: Searches for duplicate external document numbers in sales documents and posted documents (Standard function/procedure)
    date: "2026-07-24"
    commit: null
    t: null
    quote: "this standard method has a limitation: it only checks for duplicate External Document No. for the same customer"
links:
  learn: []
  objects:
    - object/codeunit/1302
    - object/table/36
    - object/table/112
  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/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/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/69444
      title: "Dynamics 365 Business Central: How to check whether External Document No./Vendor Invoice No. are unique or duplicated – Customization"
      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
    - to: post/aardvarklabs-blog/3118
      title: Leveraging RecordRef and FieldRef for Dynamic Coding
      label: possibly related
      why: both name Table 112 "Sales Invoice Header"
      by: code
post_id: "74940"
source_id: yzhums-com
source_name: Dynamics 365 Lab - Yun Zhu
url: https://yzhums.com/74940/
published_at: "2026-07-24T01:34:46.000Z"
author: Yun Zhu
full_text: false
words: 331
quotes:
  - text: Business Central does not validate whether external document numbers are unique or duplicated.
    why_it_matters: Explains why implementing duplicate detection requires either standard procedures or customization
  - text: "this standard method has a limitation: it only checks for duplicate External Document No. for the same customer"
    why_it_matters: Important constraint for developers to understand when implementing validation logic
code_objects_mentioned:
  - codeunit Customer Mgt.
  - table Sales Header
  - table Sales Invoice Header
  - table Sales Cr. Memo Header
systems:
  - sales
  - development
versions_mentioned: []
cautions:
  - kind: gotcha
    quote: "This standard method has a limitation: it only checks for duplicate External Document No. for the same customer, rather than across all customers."
    objects:
      - type: codeunit
        name: Customer Mgt.
    events: []
    versions: []
preview:
  embeddable: true
  frame_url: null
  image: https://yzhums.com/wp-content/uploads/2026/07/Snipaste_2026-07-23_14-24-34.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:02:25.235Z"
---

# Dynamics 365 Business Central: Searches for duplicate external document numbers in sales documents and posted documents (Standard function/procedure)

[Read the post](https://yzhums.com/74940/) · Dynamics 365 Lab - Yun Zhu (Yun Zhu, MVP) · 2026-07-24 · 331 words · tier community · reviewed (checked by Opus)

> Business Central provides a standard method to search for duplicate external document numbers in sales documents and posted documents. The SearchForExternalDocNo procedure in codeunit 1302 validates duplicates for the same customer, though it only checks within individual customer records rather than across all customers.

## Key points

- Standard function SearchForExternalDocNo in codeunit 1302 detects duplicate external document numbers
- Checks both unposted sales headers and posted sales invoices or credit memos
- Validation is limited to duplicates within the same customer, not across all customers
- Returns true if duplicate found, false otherwise

## Quotes

- "Business Central does not validate whether external document numbers are unique or duplicated." (Explains why implementing duplicate detection requires either standard procedures or customization)
- "this standard method has a limitation: it only checks for duplicate External Document No. for the same customer" (Important constraint for developers to understand when implementing validation logic)

## 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.

- [codeunit 1302 "Customer Mgt."](../../objects/codeunit/1302.md)
- [table 36 "Sales Header"](../../objects/table/36.md)
- [table 112 "Sales Invoice Header"](../../objects/table/112.md)
- table "Sales Cr. Memo Header"

Not found in BC28-30: table "Sales Cr. Memo Header".

## 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"
- [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: 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 check whether External Document No./Vendor Invoice No. are unique or duplicated – Customization](../../posts/yzhums-com/69444.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"
- [Leveraging RecordRef and FieldRef for Dynamic Coding](../../posts/aardvarklabs-blog/3118.md) — possibly related: both name Table 112 "Sales Invoice Header"

## Heads up

- gotcha: "This standard method has a limitation: it only checks for duplicate External Document No. for the same customer, rather than across all customers." (about codeunit Customer Mgt.)

## Context

- Features: external document number validation, duplicate detection, sales order processing, invoice management, credit memo processing

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.
