Dynamics 365 Business Central Mini tips: How to quickly get next number set in Number Series from AL (Codeunit 396 NoSeriesManagement)

Dynamics 365 Business Central

Hi, Readers.
In this post, I want to share another mini tip of Dynamics 365 Business Central. How to quickly get next number you set in Number Series from AL.
For example: Customer Nos.

Last No. Used is ‘C00040’, and Increment-by No. is ’10’. So is there any way to get the next number (“C00050”) quickly?

Yes. In Codeunit 396 NoSeriesManagement, you can find a function called GetNextNo.

Let’s try it.

For example:
NextNumber := NoSeriesMgt.GetNextNo(SalesReceivablesSetup.”Customer Nos.”, WorkDate(), true);
Note: If ModifySeries is true, Last No. Used will be updated.


If ModifySeries is false, Last No. Used will not be updated.
NextNumber := NoSeriesMgt.GetNextNo(SalesReceivablesSetup.”Customer Nos.”, WorkDate(), false);



Hope this will help.

Thanks for your reading.



Copied title and URL