Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

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();

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: Making Multiple Number Sequence for the same field

    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

  • KareemTaima Profile Picture
    KareemTaima 304 on at
    RE: Making Multiple Number Sequence for the same field

    Thank you, Martin

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

  • Martin Dráb Profile Picture
    Martin Dráb 231,430 Most Valuable Professional on at
    RE: Making Multiple Number Sequence for the same field

    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).

  • Anrini Profile Picture
    Anrini on at
    RE: Making Multiple Number Sequence for the same field

    Thank you for the share

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,430 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans