bcquality/microsoft/knowledge/data-modeling/use-no-series-codeunit-not-noseriesmanagement.md
Jesper Schulz-Wedde 2b5550c346
Some checks failed
Validate knowledge index / validate-index (push) Has been cancelled
Validate AL review fixtures / validate-review-fixtures (push) Has been cancelled
Validate frontmatter and structure / validate (push) Has been cancelled
Improve partner onboarding and documentation navigation (#174)
Lead with a complete plugin quick start and add task-oriented usage, troubleshooting, customization, and contribution guides. Preserve the broader plugin framing, correct conflicting contract guidance, support Agents folder reviews, and align repository validation. Convert existing sample references to clickable links without changing knowledge rules.

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-09 17:31:03 +02:00

1.9 KiB

bc-version domain keywords technologies countries application-area
22..
data-modeling
no-series
getnextno
ismanual
noseriesmanagement
obsolete-pending
testmanual
al
w1
all

Assign numbers with codeunit "No. Series", not the obsolete NoSeriesManagement

Description

Since 2023 release wave 1 (v22) the number-series API is codeunit 310 "No. Series", called by name in AL. Its methods include GetNextNo, PeekNextNo, IsManual, TestManual, and LookupRelatedNoSeries. The older codeunit 396 NoSeriesManagement and its InitSeries / SelectSeries / SetSeries / TestManual methods are marked obsolete-pending: they still compile but raise a deprecation warning and are scheduled for removal, so they must not appear in new code.

LLMs reproduce the legacy NoSeriesManagement pattern because it dominates pre-2023 training data. Prefer the new codeunit: it has a cleaner surface and is the only version that survives the deprecation. (The numbers matter — 310 is the current codeunit; 396 is the legacy one being retired.) Verify signatures on learn.microsoft.com or in the microsoft/BCApps source before use.

Best Practice

OnInsert assigns the number with NoSeries.GetNextNo("No. Series") where NoSeries is Codeunit "No. Series". The No. field's OnValidate guards manual entry by calling NoSeries.IsManual(...) (or TestManual) before clearing No. Series.

See sample: use-no-series-codeunit-not-noseriesmanagement.good.al.

Anti Pattern

NoSeriesMgt.InitSeries(...) for assignment and NoSeriesMgt.TestManual(...) for the manual check, where NoSeriesMgt is Codeunit NoSeriesManagement. Both are obsolete-pending and emit compiler warnings.

See sample: use-no-series-codeunit-not-noseriesmanagement.bad.al.