web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Number Sequence Not Updating To Next Value

(0) ShareShare
ReportReport
Posted on by

Hi all,

  I am using this code in order to get the next value of the number sequence associated with the smmActivityNumber:

ns = NumberSeq::newGetNum(smmParameters::numRefActivityNumber());
ns.used();
smmActivityNumber = ns.num();

  This code is located inside a loop, so for every loop it should get the next number in the sequence.  Unfortunately, this is not the case and it is always getting the first number in the sequence (ABC-00000).

  As far as I know, the smmActivityNumber EDT comes out-of-the-box with Microsoft Dynamics AX 2012.  I loaded the modules through a job by using the class NumberSeqModuleGeneral and then went to Organization Administration --> Generate.

  However, the problem still persists.  How can I solve this  please?  Thanks

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Calling used() before allocating any number (num()) looks suspicious. Wouldn't swapping the calls make any difference?

  • Suggested answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    call it as under

    NumberSeq::newGetNum(CompanyInfo::numRefActivityNumber()).num();

    also remember its part of Basic while you navigate in Organizational administration >> Number sequences.

    This number sequence is being used at many places almost in all sort of activities wheher belonging to sales, projects or others

  • Community Member Profile Picture
    on at

    Hi Martin and Sohaib,

     I ommitted one important detail.  This happens only in my local environment.  On the DEV environment, it works perfectly.  So I think it is more related to setup rather than code.

    Thanks

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    how you have done setup of number sequence in both systems? is that same w.r.t continuous checked or manual Unchecked?? have you seen this number sequence in Organization Administration for both environments?

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    So what's the setup?

  • Community Member Profile Picture
    on at

    To tell you the truth, the number sequences in both systems were not set up by me.  By any chance, do you know from where the smmActivityNumber number sequence can be set up please?  Thanks.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    301,035 Super User 2025 Season 2 on at

    Hi Anthony,

    The activity numbers can be setup on the Legal entity form per legal entity. (Organization administration > Setup > Organization > Legal entities.

    Check if the number sequence is set to continuous or not. If it is continuous in both environments, it is probably not due to the coding. Then check if the SQL database has all the needed stored procedures to be able to retrieve numbers.

    Check my blog for details on this stored procedure and how to create it when needed: kaya-consulting.com/solve-continuous-number-sequence-issue-in-ax-2012-r2

    PS when using the newGetNum() method without an optional additional parameter to make a decision later '_makeDecisionLater', the used() method is not needed.

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    you can also run following job before running Wizard to setup sequence

    static void LoadNumSeqGenModule(Args _args)

    {

       NumberSeqModuleGeneral objNumberSeqModuleGeneral = new NumberSeqModuleGeneral();

       objNumberSeqModuleGeneral.load();

       info("Done");

    }

  • Community Member Profile Picture
    on at

    Thank you so much for your feedback Andre.  I will try it out and let you know if it worked.  Thanks again.

  • Community Member Profile Picture
    on at

    Hi Sohaib,

     I carried out this step to no avail.  I will try out Andre's suggestion and see if it works.  Thanks a lot.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans