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

I have the same question (0)
  • Anrini Profile Picture
    on at

    Thank you for the share

  • Martin Dráb Profile Picture
    237,876 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

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

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans