Create a new number sequence in ax 2012

Number Sequence Creation:

Here I want to design a form named FirstForm with DataSource FirstTable

I want to create sequence  like "AX00001---------AX99999".

Step 1

Create an EDT - String Type

So, I created an EDT named "AXSeqEDT" with label "AX Seq"

Drag into Table(FirstTable)àFields

Step 2

Now create a new Number Sequence

Path for creating num Sequence is

"Module:: Organization administration.......Common.........Number sequences......Number sequences"

Click on New(Number Sequence)

Now number Sequence form will be opened----That contains 4 sections.

Section 1.Identification.....Specify the NumberSeqCode and Name

Section 2.Scope Parameters... Select the Scope from the Dropdown

Section 3.Segments.... Add the constant and alphanumeric (by clicking the add button and selecting from drop down)

Section 4 .General.....Checkmark for continous and Specify the "smallest and largest and Next" Fields

Now Save Ur Settings

Step 3

Now add the Respective manual-code to class - NumberSeqModuleURMODULE

And Table - URMODULEParameters.

So I am creating number sequence based on HRM Module.....So iam using classNumberSeqModuleHRM and Table HRMParameters

Now go to AOT---Classes-NumberSeqModuleHRM---loadModule()

Add the code here...

Note::Here we can add the code seeing the existing implementation

The Added Code is::

/* setup discussion number sequence - it is global */

    datatype.parmDatatypeId(extendedtypenum(AXSeqEDT));

    datatype.parmReferenceHelp(literalstr("@SYS32633"));

    datatype.parmWizardIsContinuous(true);

    datatype.parmWizardIsManual(NoYes::No);

    datatype.parmWizardIsChangeDownAllowed(NoYes::No);

    datatype.parmWizardIsChangeUpAllowed(NoYes::No);

    datatype.parmWizardHighest(99999);

    datatype.parmSortField(12);

    this.create(datatype);

Now Goto AOT---Tables---HRMParameters---methods-----click on new method


Add the code In the New method

Note::Here we can add the code seeing the existing implementation

The Added Code is

static client server NumberSequenceReference numRefAXSeqEDT()

{

return NumberSeqReference::findReference(extendedTypeNum(AXSeqEDT));

}

Step 4

In order to add our newly created number sequence reference to our Module write the following Job and Execute it

Below job is important to run because without it your new number sequence will not be available to number sequence form under Parameters. This is the change in behavior from AX 2009 where all new number sequence loads while restarting the Dynamic AX. In AX 2012 all the number sequence created to system while installation, so restarting the AOS wont effect in loading the new number sequence, that is why it is important to run the job to load new number sequences.

The Code added in The Job is

static void jobName(Args _args)

{

    NumberSeqModuleHRM  NumberSeqModuleHRM = new NumberSeqModuleHRM();

    ;

    NumberSeqModuleHRm.load();

}

Step 5

After executing the Above Job, our newly created number Sequence reference "AX Seq" will be added to HRM Module----Number sequence setup form

Lets Check it

Now click on Number Sequence and Identify the newly created Number Seq Reference

After Identifying the Number Sequence Reference ----Allot the Number Sequence Code to the Number Sequence Reference.....By selecting from the drop down list

Step 6

Now add the Code in Create method of Forms Datasource methods

Goto-AOT-Forms-FirstForm-Datasources-FirstTable-Methods-Override method(Create)

public void create(boolean _append = false)

{

    ;

super(_append);

    FirstTable.AXSeqEDT = NumberSeq::newGetNum(HRMParameters::numRefAXSeqEDT(),true).num();

}

Step 7

Now save all ur settings.....Now Open our form-FirstForm

Imparted

Microsoft Dynamics AX 2012 Development Cookbook

Overview

  • Develop powerful, successful Dynamics AX projects with efficient X++ code with this book and eBook
  • Proven recipes that can be reused in numerous successful Dynamics AX projects
  • Covers general ledger, accounts payable, accounts receivable, project modules and general functionality of Dynamics AX
  • Step-by-step instructions and useful screenshots for easy learning
  • Numerous development tips and tricks for daily usage
  • This book is an update to Microsoft Dynamics AX 2009 Development Cookbook

Table of Contents

Preface
Chapter 1: Processing Data
Chapter 2: Working with Forms
Chapter 3: Working with Data in Forms
Chapter 4: Building Lookups
Chapter 5: Processing Business Tasks
Chapter 6: Integration with Microsoft Office
Chapter 7: Using Services
Chapter 8: Improving Development Efficiency
Chapter 9: Improving Dynamics AX Performance
Index

Up

  • Chapter 1: Processing Data
    • Introduction
    • Creating a new number sequence
    • Renaming the primary key
    • Merging two records
    • Adding a document handling note
    • Using a normal table as a temporary table
    • Copying a record
    • Building a query object
    • Using a macro in an SQL statement
    • Executing a direct SQL statement
    • Enhancing the data consistency check
    • Exporting data to an XML file
    • Importing data from an XML file
    • Creating a comma-separated value file
    • Reading a comma-separated value file
    • Using the date effectiveness feature

    Up

    • Chapter 2: Working with Forms
      • Introduction
      • Creating a dialog
      • Handling a dialog event
      • Building a dynamic form
      • Adding a form splitter
      • Creating a modal form
      • Modifying multiple forms dynamically
      • Storing last form values
      • Using a tree control
      • Building a checklist
      • Adding the View details link

      Up

      • Chapter 3: Working with Data in Forms
        • Introduction
        • Using a number sequence handler
        • Creating a custom filter
        • Creating a custom instant search filter
        • Building a selected/available list
        • Preloading images
        • Creating a wizard
        • Processing multiple records
        • Coloring records
        • Adding an image to records

        Up

        • Chapter 4: Building Lookups
          • Introduction
          • Creating an automatic lookup
          • Creating a lookup dynamically
          • Using a form for building a lookup
          • Building a tree lookup
          • Displaying a list of custom options
          • Another way of displaying custom options
          • Building a lookup based on record description
          • Building the Browse for Folder lookup
          • Building a lookup for selecting a file
          • Creating a color picker lookup

          Up

          • Chapter 5: Processing Business Tasks
            • Introduction
            • Using a segmented entry control
            • Creating a general journal
            • Posting a general journal
            • Processing a project journal
            • Creating and posting a ledger voucher
            • Changing an automatic transaction text
            • Creating a purchase order
            • Posting a purchase order
            • Creating a sales order
            • Posting a sales order
            • Creating an electronic payment format

            Up

            • Chapter 6: Integration with Microsoft Office
              • Introduction
              • Creating an Excel file
              • Reading an Excel file
              • Creating a Word document from a template
              • Creating a Word document with repeating elements
              • Creating a Microsoft Project file
              • Sending an e-mail using Outlook

              Up

              • Chapter 7: Using Services
                • Introduction
                • Consuming the system query service
                • Consuming the system metadata service
                • Consuming an existing document service
                • Creating a document service
                • Consuming a document service
                • Using an enhanced document service
                • Creating a custom service
                • Consuming a custom service
                • Consuming an external service

                Up

                • Chapter 8: Improving Development Efficiency
                  • Introduction
                  • Creating an editor template
                  • Modifying the Tools menu
                  • Modifying the right-click context menu
                  • Searching for an object in a development project
                  • Modifying the Personalization form
                  • Modifying the application version

                  Up

                  • Chapter 9: Improving Dynamics AX Performance
                    • Introduction
                    • Calculating code execution time
                    • Writing efficient SQL statements
                    • Caching a display method
                    • Using Dynamics AX Trace Parser
                    • Using SQL Server Database Engine Tuning Advisor

                    Up

                    What makes a good Dynamics AX Project Manager?

                    The success and failure of Dynamics AX project is directly related to the quality of the project manager leading it. A recent survey of PWC showed that over 85% of dynamics ax project failed to achieve their core objectives – poor project management was one of the root causes.

                    to complete the post kindly click this link