Announcements
I want to ask that in the picture below, there is a field ("Document No.") whose datatype is Code[20] but still the field is auto-incremented whenever a new line is created. Like in the above picture, for the first line "Document No." was G0003 and automatically when I initialized the new line the "Document No." becomes G0004. How can a Code datatype be auto-incremented? And how can I do that when I have to enter it by passing some action?
There can be many situation where you want to increment a code field or a text string without connecting a no, series to it. And in those cases incstr is the correct way to handle it.
There can also be situations where using the NoSeriesManagement codeunit causes locking in your system, then you need and alternative way to increase your code field.
So "one wheel" does not always fit all scenarios.
Thanks everyone, but IncStr() worked for me.
Hi, Just to add a simple example.
How to use the standard No. Series on custom data in Dynamics 365 Business Central (Automatic Number Series)
Hope this can give you some new hints too.
Thanks.
ZHU
If you are writing AL code and do not have any no. series connected to your field you can use the incstr function as documented here:
Hi Muhammad
"Document No." is Data Type=Code field Increment Automatically with the help of GetNextNo Function this function is available on Table No 81.
this Function use NoSeries that is Assign on "Payment Journal Batch" Page.
How to create No. Series : https://learn.microsoft.com/en-us/dynamics365/business-central/ui-create-number-series
hi
use this function in codeunit 396
DAniele
You can find the function in Table 81 - IncrementDocumentNo
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156