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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Number sequence not generating inside wizard

(0) ShareShare
ReportReport
Posted on by

Hi guys,

I have a problem with number sequence (yet again).

I used to work with number sequence and it worked in the past. However, just now, I realized I need another edt to the number sequence. So I went ahead and tried adding in, only to find out that the number sequence does not appear in the wizard, where I need to generate in order to work with it.

Here is what I did:

1) Made an extension of NumberSeqModule, and added a new element to it, calling it "HISServiceObject".

2) Created a class called NumberSeqModuleHISService, which extends NumberSeqApplicationModule

3) Added the following code into it:

class NumberSeqModuleHISService extends NumberSeqApplicationModule
{
    //creates the parameter for the number sequence
    protected void loadModule()
    {
        NumberSeqDatatype datatype = NumberSeqDatatype::construct();

        /*Setup HISRegId*/
        datatype.parmDatatypeId(extendedTypeNum(HISRegId));
        datatype.parmReferenceHelp("Unique key for TableA、TableB、TableC、TableD");
        datatype.parmWizardIsContinuous(true);
        datatype.parmWizardIsManual(NoYes::No);
        datatype.parmWizardIsChangeDownAllowed(NoYes::No);
        datatype.parmWizardIsChangeUpAllowed(NoYes::No);
        datatype.parmWizardHighest(999999999);

        // Use the DataArea segment
        datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
        this.create(datatype);

        /*Setup History ID*/
        datatype.parmDatatypeId(extendedTypeNum(HISHistoryId));
        datatype.parmReferenceHelp("Unique key for TableA");
        datatype.parmWizardIsContinuous(true); 
        datatype.parmWizardIsManual(NoYes::No);
        datatype.parmWizardIsChangeDownAllowed(NoYes::No);
        datatype.parmWizardIsChangeUpAllowed(NoYes::No);
        datatype.parmWizardHighest(999999999);

        // Use the DataArea segment
        datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
        this.create(datatype);

        /*Setup TranID*/
        datatype.parmDatatypeId(extendedTypeNum(HISTranId));
        datatype.parmReferenceHelp("Unique key for TableA, TableB & TableC、TableD");
        datatype.parmWizardIsContinuous(true); 
        datatype.parmWizardIsManual(NoYes::No);
        datatype.parmWizardIsChangeDownAllowed(NoYes::No);
        datatype.parmWizardIsChangeUpAllowed(NoYes::No);
        datatype.parmWizardHighest(999999999);

        // Use the DataArea segment
        datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
        this.create(datatype);
    }

    /// <summary>
    /// Retrieves the ID of the application-specific module for this class
    /// </summary>
    /// <returns>
    /// the module-specific ID
    /// </returns>
    public NumberSeqModule numberSeqModule()
    {
        return NumberSeqModule::HISServiceObject;
    }

    /// <summary>
    /// Appends the current class to the map that links modules to number sequence data type generators.
    /// </summary>
    [SubscribesTo(classStr(NumberSeqGlobal),delegatestr(NumberSeqGlobal,buildModulesMapDelegate))]
    static void buildModuleMapSubsciber(Map numberSeqModuleNamesMap)
    {
        NumberSeqGlobal::addModuleToMap(classNum(NumberSeqModuleHISService), numberSeqModuleNamesMap);
    }

}

4) Built everything (database synced) and executed the form
5) Navigated to Number sequence to generate it through wizard, but I do not see HISRegId there (although I can see HISHistoryId and TranID)....

Could anyone please point out which part am I doing wrong?

Thanks.

Lincoln Poh

*This post is locked for comments

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    304,553 Super User 2026 Season 1 on at

    Hi Lincoln,

    When creating a new company, a record will be created in the number sequence references table. Within an existing company, the code is not executed. You could create the records in the NumberSequenceReference table manually or using a script.

  • Community Member Profile Picture
    on at

    Hello Andre

    Thank you for the prompt reply.

    That is the first time I heard of, that codes are not executed in existing company...

    How do I go about creating a record manually inside NumberSequenceReference table? Because all I see are records everywhere with unfamiliar fields.

    And how would I be able to add in manually through a script?

    Is this a common practice during customization, when there is a need to add in additional number sequences into an existing record?

    kind regards

    Lincoln Poh

  • Verified answer
    André Arnaud de Calavon Profile Picture
    304,553 Super User 2026 Season 1 on at

    Hi Lincoln,

    Try to see if you can rerun NumberSeqApplicationModule::loadAll or take parts of this script to get your records.

  • Verified answer
    Community Member Profile Picture
    on at

    Hi Andre,
    Thank you for the fast response again!
    I just tried it, and it works brilliantly!!
    For the sake of those who are looking for the solution, here's what worked for me using Andre's solution:
    1) Create a runnable class
    2) Inside the main() method, add in the code below (which was provided by Andre):

    class TestRunnableClass
    {        
        /// <summary>
        /// Runs the code inside the main method just once
        /// </summary>
        /// <param name = "_args"></param>
        public static void main(Args _args)
        {   
            NumberSeqApplicationModule::loadAll(); //add this line of code
        }
    
    }

    3) Set the Runnable class as the startup object, build it and run AX
    4) Try generating the number sequence through the wizard again and now everything should work!

    *Once the number sequence has been successfully generated through the wizard, we no longer need the Runnable class. You could delete it, leave it inside your project, etc, all up to you. *

    Thanks again, Andre!!

    regards

    Lincoln Poh

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans