bl al error AL0185: Codeunit 'NoSeriesManagement' is missing
The error AL0185: Codeunit 'NoSeriesManagement' is missing in Microsoft Dynamics 365 Business Central occurs because the NoSeriesManagement codeunit has been deprecated and removed in recent versions (specifically in Business Central v27, and marked for removal in v24/2024 Wave 1).
Microsoft has replaced the old codeunit with a new, more modular system involving the
No. Series and No. Series - Batch system modules. Solution
To resolve this error, you need to update your AL code to use the new pattern:
- Replace references to the old
NoSeriesManagementcodeunit with the newNo. Seriescodeunit for single number series operations orNo. Series - Batchfor performance-optimized, multiple number series operations. - Add necessary dependencies to your
app.jsonfile for the new Business Foundation application, if not already included. The new codeunits are part of this foundational layer. - Refactor your code to call the new methods. The functions are similar but use different syntax and structures.
Example Code Snippet (before/after)
The general logic for getting the next number has changed from a direct call to the old codeunit to using the methods in the new ones.
Old approach (will cause error):
var
NoSeriesMgt: Codeunit NoSeriesManagement;
...
begin
...
"No." := NoSeriesMgt.GetNextNo(SalesSetup."Model Nos.", Today(), true);
...
end;
New approach (using Codeunit "No. Series"):
var
NoSeries: Codeunit "No. Series";
...
begin
...
"No." := NoSeries.GetNextNo(SalesSetup."Model Nos.", Today(), true);
...
end;

Comentarios
Publicar un comentario