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, ...
Suggested Answer

Select from Multiple Number Sequence for the same Field AX2012

(0) ShareShare
ReportReport
Posted on by 46

Hi All,

I am trying to setup multiple number sequence for the same field.

when creating Productions (choose from NP-#### or just ##### for the ProdId), this will also be replicated in other modules like in Purchase or sales orders.

I found this tutorial for ax2009 that I think it could fit with my requirement. But is not entirely compatible with AX2012. in the tutorial he is using a lookupNumberSequenceCode method that is not found in the number sequence Table (  NumberSequenceTable::lookupNumberSequenceCode(control, this.parmParentCode()); )

does anybody have this code somewhere? I would like to know how is implemented maybe I can adapt to the AX2012.

I also found this tutorial but I don't get the last Step where he assigns the table field to the number sequence.

any help is greatly appreciated

thanks a lot!

I have the same question (0)
  • ergun sahin Profile Picture
    8,826 Moderator on at

    I hadn't tried it the way Kareem did. Kareem create a number sequence in each module (sales/buying etc.) and gives it a different name. he write a method for each module in the table (using the names he give). He will choose method at the time of generating the number series.

    The first example, on the other hand, focused more on the operation of the standard field for more than one series in a single module.

    Apart from these, you can examine the number sequence group structure or you can open a numberSeqCode field for each module in a parameter table and directly get which series to use from there.

  • CBNestor Profile Picture
    46 on at

    Hi Ergün,

    I still have some doubts:

    1. Do you anyhow have the code for this table method in ax2009 NumberSequenceTable::lookupNumberSequenceCode() ?

    2. Do you know where to assign the field excacly from Step 6 from Kareem method?.

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

    in my case the table is ProdTable.ProdId and method ProdTable:ProdId_NP()

    3. Do you have any tutorial for this Sequence Group Structure you are mentioning .

    I am just beginning with handling number sequence by code. So I might no follow you that simple.

    thanks again for your help

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    Consider having more than one method in step 5.

    NumberSequenceReference NumSeqRefSales()

    NumberSequenceReference NumSeqRefPurch()

    .

    .

    All you have to do is use the relevant method at the time of generating the ID. You can make this decision with an enum (for example, if you have the custVendActype value)  or by choosing from a list. (or based on the code you're in)

  • ergun sahin Profile Picture
    8,826 Moderator on at

    I don't have much idea about lookupNumberSequenceCode. You should have a look at 2009, but it's probably not standard. I think it's a lookUp he wrote for the parent field he just added.

    If you copy the lookupReference method and write a method that will filter the new field, I think it will work. (This solution touches the standard structure too much. I wouldn't prefer it.)

  • CBNestor Profile Picture
    46 on at

    Now I understand what you say.

    so I have managed to create a Base Num for the ProdId numSeq selection and added as combobox control in the ProdTableCreate Form

    now the problem that I see is that if I close the form and open again. every time I do that the number sequence is incrementing... Is it possible to get it incremented only when the production is in fact really created (inserted in the ProdTable)?

    pastedimage1630054760239v1.png

    millon thanks again

  • ergun sahin Profile Picture
    8,826 Moderator on at

    I don't know at what stage you created the number series, but it should have a feature such as undo when it is closed without using it.(numberSeq.used()/-/-/numberSeq.abort())

    Or you can put the code for generating the number sequence under closeOk (I haven't looked into the structure of the form, but I think the standard does something similar)

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 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans