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 :
Finance | Project Operations, Human Resources, ...
Active Discussion

Making Multiple Number Sequence for the same field

(1) ShareShare
ReportReport
Posted on by 304

Hi all,

Hope you're doing fine.

I had to face a business need that requires to use several sequence number on the same field based on some selection from a list or an Enum, I didn't know how to do it at first, but I managed to do it.. so I'm sharing it with you, I hope it helps 

1- first you need to check if the targeted field has number sequence assigned or not, if yes… You need to either cancel the setup for this field or just make the number sequence manual

2- you need to create N number of EDT equals N number of sequence numbers you'll use

3- find the number sequence module you want your number sequences to belong to it and create N number of parameters data type like below:

    datatype.parmDatatypeId(extendedTypeNum("EDTname"));
    datatype.parmReferenceHelp(literalStr("EDT Name")); //this a string, so you write it with quotes like this "Sales Id", it's the reference help so describe it like you want
    datatype.parmWizardIsContinuous(true);
    datatype.parmWizardIsManual(NoYes::No);
    datatype.parmWizardIsChangeDownAllowed(NoYes::No);
    datatype.parmWizardIsChangeUpAllowed(NoYes::No);
    datatype.parmSortField(52); // that's not a constant value, just check for the last parameter number and add 1

    datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
    this.create(datatype);

you can change any value according to your business case

4- create a job that loads the number sequence module like below:

//assuming the number sequence module is NumberSeqModuleCustomer

    NumberSeqModuleCustomer   numberSeqMod;
    numberSeqMod = new NumberSeqModuleCustomer();
    numberSeqMod.load();

//run the job

5- create N number of methods in the table which holds the targeted field like below:

static client server NumberSequenceReference "method name"()
{
    return NumberSeqReference::findReference(extendedTypeNum("EDT name"));
}

6- after you check for the selection of your list or Enum, assign the field like below:

"TableName"."FieldName"= NumberSeq::newGetNum("TableName"::"MethodNameforspecificEDT"(),true).num();

  • Anrini Profile Picture
    Microsoft Employee on at

    Thank you for the share

  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    This seems to belong to your previous thread, Multiple number sequence on the same field. I'll at least link those threads...

    Maybe you'd interested in starting a blog. Note that discussions forums are intended for discussion, which isn't the case of this thread.

    And when pasting code to the forum, please use Insert > Insert Code (in the rich-formatting view).

  • KareemTaima Profile Picture
    304 on at

    Thank you, Martin

    I didn't know that there's the ability to start a bog here, I'll go for it

  • CBNestor Profile Picture
    46 on at

    Hi Kareem,

    thanks for the sharing. I am trying to apply the same logic but I having issues with some of the steps

    I am on the step numer 6. "after you check for the selection of your list or Enum, assign the field like below:"

    "TableName"."FieldName"= NumberSeq::newGetNum("TableName"::"MethodNameforspecificEDT"(),true).num();

    where is this assign?.

    I am trying to use two numSeq for ProdTable.ProdId. so when a new production is created it should ask me for the numSeq that I want to use, like dropdown list?

    I haven't work with number sequence by x++ before so some steps are new for me..

    thanks before hand for the help

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 616

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 460 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 331 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans