D365 – How to create number sequence

Today I will be discussing about how to create custom number sequence in D365. Number sequence framework in 2012 and AX7 is quite similar. In AX 2012 we can customize existing classes like NumberSeqApplicationModule but in AX7 we need to extend those classes in order to work on its different methods.

Scenario : Let’ s say whenever we place a order for any item we need to generate a unique and sequential order id for it. So for this purpose I will be using number sequence framework.

Below are the steps which are required to be followed for creating number sequence.

Step 1) Created a new project with name Order Management Number Sequence

1

Step 2) Create a new EDT. Right click on your project, add new item, Select EDT String and give it name as “OrderNumberId”.

2

3

Step3)  Create a new class NumberSequenceModuleProcureAndSourcing and extend it with NumberSeqApplicationModule. Override/Add following methods in it.

  1. initializeReference4a
  2. loadModule4b
  3. numberSeqModule4c
  4. buildModulesMapSubscriber4d
  5. numRefOrderNumberId4e

Step 4) Create a new job and add below mentioned code in it. I have created a new class namely OrderIdNumberSequence and executed it by setting as startup object.

5

After running job below is its output

6

Step 5) Run the wizard by using following navigation – Organizational administration -> Common Forms -> Number Sequences-> Number Sequences-> Generate -> Run the wizard

Step 6) Create a job and add below mentioned code in it. It will generate a new number sequence.

Note:  I have used previously created job.

7

Step 7) Build project and execute the job.

Final output : New number sequence for order id created successfully

8

3 thoughts on “D365 – How to create number sequence”

    1. Well you can attach this job with menu item and add it in your module by creating extension of your desired module menu (For instance Account payable). Then you will be able to execute it front end of AX without using VS.

      Like

Leave a comment