community postSales & Receivablescommunity - not Microsoftreviewed - checked by Opus

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

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.

post Dynamics 365 Lab

Yun Zhu · 2026-07-24 · 331 words · about 2 min

"Business Central does not validate whether external document numbers are unique or duplicated."

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.

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

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

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.