Steps for Number Sequence

  1. Create Element in BaseEnum ‘NumberSeqModule’ with name as ‘ASM’
  2. Create a new class named as ‘NumberSeqReference_ASM’.
  3. Under this ‘NumberSeqReference_ASM’ class ,have to create two methods. (For Example)

Here for document code I have created a number sequence.

‘DocumentCode’ given in this method is a extended data type.So it is necessary to create extended datatype.if u want to create numbersequence for ‘equipment code’,u have to create extended data type for it.

  1. LoadModule()
protected void loadModule()
NumberSequenceReference numRef;
/* Document number */
numRef.dataTypeId = typeId2ExtendedTypeId(typeid(DocumentCode));
numRef.referenceHelp = literalStr("@ASM66");
numRef.wizardContinuous = true;
numRef.wizardManual = NoYes::No;
numRef.wizardAllowChangeDown = NoYes::No;
numRef.wizardAllowChangeUp = NoYes::No;
numRef.wizardHighest = 999999;
//Suppose if u want to add more number sequences just copy the 8 lines before and paste it here and change the extended datatype.before I created for document code.
  1. numberSeqModule()
public static client server NumberSeqModule numberSeqModule()
return NumberSeqModule::ASM;
  1. In ‘NumberSequenceReference’ Class under the ‘moduleList’ method add the following code:
moduleList += NumberSeqReference_ASM::numberSeqModule();
  1. In ‘NumberSequenceReference’ Class under the ’construct’ method add the following code at the end:
case (NumberSeqReference_ASM::numberSeqModule()) : return new NumberSeqReference_ASM(_module);

Now Go to basic module in dynamics ax and under the setup menu you can find the number will have two forms in it.i)Number Sequences ii)References.

  1. Open Number Sequences Form:

Create a number sequence and set its format.

  1. Open References Form:

Assign the numbersequence which is created in the previous screen to the document code which was add in the loadModule() method.The ED T added in the load module method will be listed in this screen as shown in below screen.

Steps to be followed in form which you are going to assign number sequence:

(Example is Document Code)

  1. In Form declaration Just declare:
    1. NumberSeqFormHandler numberSeqFormHandler;
  2. Add a new method’numberSeqFormHandler’.
NumberSeqFormHandler numberSeqFormHandler()
if (!numberSeqFormHandler)
numberSeqFormHandler = NumberSeqFormHandler::newForm(ASM_DocumentRegister::numRefDocumentCode().NumberSequence,
return numberSeqFormHandler;

ASM_DocumentRegister’ is a table and numRefDocumentCode() is a method in it.same like this create a method in the table under this method.

server static NumberSequenceReference numRefDocumentCode()
return NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(DocumentCode)));

DocumentCode’ is a extendeddatatype created before.

fieldnum(ASM_DocumentRegister,DocumentCode) in this ‘DocumentCode’ is the name of the field.

In Form datasource have to add override methods:

  1. Create Method:

Before ‘super(_append); ‘ paste the code given below:

  1. InitValue Method:

After ‘Super’ paste the code given below:

  1. Write method:

After ‘Super’ paste the code given below:

  1. Delete Method:

After ‘Super’ paste the code given below:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s