Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AX2012 R2 Number seqeunce Continuous option

(0) ShareShare
ReportReport
Posted on by 11,279

Hi all,

I am confused on how this suppose to work. Any advice is appreciated. I've found 3 different scenarios so far...

1) Purchase Requisition ID - PurchReqTable is has SaveDataPerCompany = No. So it's a shared number sequence. I assigned a continuous number sequence to it.
When I create a new PR (e.g. PR-001), a respective line will be generated in the numberSequenceList table. Then I close my client and log back in, run a manual clean up. After that, PR-001 is freed. The problem is I have never delete the PR created earlier. And when generating new PR system will try to use PR-001 and generate a duplicate key error.
[The cleanup code checks whether the session is still active before allowing the record in numberSequenceList to be freed, which is the reason I needed to close the client and log back in. I can't find logic that checks whether the ID is in use.]

2) Sales Quotation ID - It uses a company specific number sequence. When I create a new SQ (e.g. SQ-001), nothing gets created in numberSequenceList table. Now I deleted SQ-001, still nothing in NumberSequenceList table. Manual clean up -> nothing. As a result, SQ-001 is lost unless I manually change the "next" back to 1. 

3) Journal Batch ID - This one is similar to 2), but the delete method in LedgerJournalTable include a line of code which explicitly release the batch number code. It generates a "free" record in NumberSequenceList table. And when creating a new journal system will correctly pick up the free journal batch ID.

Thanks in advance.

*This post is locked for comments

  • dolee Profile Picture
    11,279 on at
    RE: AX2012 R2 Number seqeunce Continuous option

    Hi HKS,

    As I see you also posted the same in another discussion (community.dynamics.com/.../112023.aspx).

    It is important for you to report this issue to Microsoft and ask for a hotfix if you hope they'd do something about it.

    In the link above I also mentioned a quick fix for exactly the purchase order number sequence. Feel free to evaluate it in a test environment.

  • HKS Profile Picture
    10 on at
    RE: AX2012 R2 Number seqeunce Continuous option

    Hi Dominic,

    This is a very basic and common process. Such as creating a New Purchase order & then deleting if it is not required, is common. The number sequence should strictly not skip, if it is set to continuous. This is a big issue as the end users need to have a track of sequence number of purchase orders and any missing number in the sequence for PO No. is an important issue & the end users are accountable.

    1) Create New PO, No is: PO-0001

    2) Delete it

    3) Create New PO & now number is: PO-0002 (That's insane. Logically it should surely be PO-0001 & not PO-0002. Although the number sequence is set to continuous)

    This is really annoying and doesn't make sense to end users and it is not logical at all.

    Please share with us anything if you have any bit of information related to it. I am sure most of them must be facing this issue as it is a common practice and day to day simple business process. Microsoft can not make a blunder in such a basic process. They really need to fix this.

    Thanks

    HS

  • dolee Profile Picture
    11,279 on at
    RE: AX2012 R2 Number seqeunce Continuous option

    Hi Jahan,

    You probably have the same conclusion already but it seems the issue is one or more processes incorrectly freed some numbers.

    A relatively easy way out would be setting up a batch job to periodically verify/clean the status list.

    On the other hand, to try to find out which process creates this problem, I would consider add custom code to log inserts/updates to the status list to try to catch what triggers the issue. The post below can help you view the callStack at the time of insert/update

    community.dynamics.com/.../get-ms-dynamics-ax-call-stack-in-x-code.aspx

  • Community Member Profile Picture
    on at
    RE: AX2012 R2 Number seqeunce Continuous option

    Hi Dominic,

    I am also facing a similar issue, sometimes when I create new inventory movement journal it always picks an already used number, sometimes when we close the client and restart, it resolves the issue sometimes we have to reset the number sequence by removing continuous check box and again selecting it.

    Note: Not every number is fetched in status list in fact whenever I check the list it is empty. But when this issue arises then there is this number in the list which is free.

    Any idea? I am stuck with this issue and even cannot reproduce it by will, it just happens which is quiet annoying.

    Thanks in advance for your help.

    kind regards,

    Jahan Zaib Hassan

  • Community Member Profile Picture
    on at
    RE: AX2012 R2 Number seqeunce Continuous option

    I did bypass this by changing number sequence related system classes similar to AX 2009. Making direct call from form to number sequence classes. In 2012, the is was made from Form to its table and from table to number sequence class, so the call expired when transitioned from form to table, it lost data. 

    I do remember my team raising bug with Microsoft but not sure if we received any solution. 

  • mackie_garcia Profile Picture
    10 on at
    RE: AX2012 R2 Number seqeunce Continuous option

    Hi,

    Anyone raised this to Microsoft? is there any existing fix we could use for this?

    Thanks,

    Mackie

  • Community Member Profile Picture
    on at
    RE: AX2012 R2 Number seqeunce Continuous option

    Hi Dominic/Andre,

    I was trying to understand this bug in Ax2012. I have observed that when we set a number sequence as continous it is populating numbserSequenceList table each time when the number is used or not. But in Ax2009 , this table is only populated when the number is not used. Hence when we run number sequence clean up job, the system is relasing both used and unused numbers.

    Were you able to resolve this bug,  I am stuck at understanding how NumberSequenceList is updated on the form close as the Debugger on NumberSeq.releaseNumber() and NumberSequenceList.Insert() is not working. I have tried to debug in Non IL and IL mode in Ax and Visual Studio. Debugger is not hit on the form close.

    Thanks.

  • André Arnaud de Calavon Profile Picture
    294,715 Super User 2025 Season 1 on at
    RE: AX2012 R2 Number seqeunce Continuous option

    Hi Dominic,

    I also thought that this issue only belonged to versions 2.5 and 3.0....

    Mostly with wrong customizations this issue appeared in versions 4.0 and later.

    Now... it seems to be back. :-(

  • dolee Profile Picture
    11,279 on at
    RE: AX2012 R2 Number seqeunce Continuous option

    Thanks Andre. Really appreciate your comments.

    I have debug scenario 1 & 2 again with your added information. What I observed agrees with your suggestions on what had happened.

    Never had to work deeply with continuous number sequence....and didn't expect it being so buggy since it's been around since at least AX3.0. As a side note, I am playing with the demo data from MS. The Sales Quotation Id uses a continuous number sequence in it so it's most likely a bug.

    Cheers.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    294,715 Super User 2025 Season 1 on at
    RE: AX2012 R2 Number seqeunce Continuous option

    Hi Dominic,

    Scenario 3 is the correct way of working with continuous number sequences. When created the record no record should be in the NumberSequenceList. When deleting the record, the number should be present in this list for new actions.

    When developing a table using the numbersequence you can specify whether to make a decision for having the new number used later or directly (parameter of the methods). When specified later, a record will be created in the NumberSequenceList with the status 'Active'. This is your scenario 1.

    When using the parameter '_makeDecesionLater' you also have to call the method 'used' on the NumberSeq class.

    Then the record is deleted, as the number is really used. I think this one is missing for the Purchase requisition id.

    When deleting a record, code should be executed where the system knows to create a record in the NumberSequenceList. This is apparently not well supported in your scenario 2.

    So, my opinion is that there are 2 bugs in this case. Scenario 1 and scenario 2 are incorrect.

    It might be by design that Continious is not supported for Sales Quotation Id, but then I should expect an error at time op setup or some stating that continous is not supported.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 46

#3
shanawaz davood basha Profile Picture

shanawaz davood basha 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans