Number Sequence in Dynamics AX 2012 – Part 2

Create a Number Sequence from Scratch

Now we will implement a Number Sequence in an existing Form.

Objective

Create a Number Sequence HCMEmploymentLeave form.

Solution

We will take a few steps to achieve this.

In this example, we will create a Number Sequence from scratch for Employment leave. The Form and the table which we are going to use are “HCMEmploymentLeave” and “HCMEmploymentLeave”. Please note that you might see few fields

Step 1: Create an EDT of type string

Here we have create EDT with name HCMEmploymentLeaveId

16-Create-an-EDT -of-type-string

Step 2: Drop the EDT in the field of table you plan to make sequence number for

17-Drop-the-EDT -in-the-field-of -table

Step 3: Add the code in the NumberSeqModule###

18-Add-the-code -in-the -NumberSeqModule

Step 4: Create a method in HRMParameterTable to return the Number Sequence Reference

19-Create-a -method-in -HRMParameter -Table -to-return -the-Number -Sequence -Reference

 

Step 5: Declare NumberSeqFormHandler in the Form “HCMEmploymentLeave”

20-Declare- NumberSeqFormHandler-in-the -Form

Step 6: Add the NumberSeqFormHandler method to the form

21-Add-the -NumberSeqFormHandler-method -to-the-form

Step 7: Add create(), delete(), write(), ActiveLink() and validateWrite() methods to the methods of Data Source of the Form

HCMEmploymentLeave: Create()

public void create(boolean _append = false)
{
element.numberSeqFormHandler().formMethodDataSourceCreatePre();
super(_append);
element.numberSeqFormHandler().formMethodDataSourceCreate();
}

 

HCMEmploymentLeave: delete()

public void delete()
{
element.numberSeqFormHandler().formMethodDataSourceDelete();
super();
}

HCMEmploymentLeave: write()

public void write()
{
super();
element.numberSeqFormHandler().formMethodDataSourceWrite();
}

HCMEmploymentLeave: close()

public void close ()
{
if (numberSeqFormHandler)
{
numberSeqFormHandler.formMethodClose();
}
super();
}

 

Step 8: Create a Job with following code and Run

static void NumberSeqLoadAll (Args _args)
{

NumberSeqApplicationModule::loadAll();

}

 Step 8: Create a Job as below and Run

22-Create-a -Job

Step 9: Check and verify that the Number Sequence have been created for the reference

The process is same as described in the section Create a new Number Sequence.

Result

23-Check-and -verify-that-the -Number Sequence

Implement the Number Sequence and see it in action

 

25-Implement-the -Number -Sequence

 

24-Implement-the -Number -Sequence

Abubaker Siddiq Shekhani

Abubaker Shekhani is an IT Entrepreneur and Full Stack Developer. He is the co-founder and the Developer behind Mytabeeb, a health care solution. He has worked for 5 years in Microsoft Dynamics AX space with Techno-functional role and glad to be one of few Microsoft Dynamics AX developers/consultants in Pakistan. He is TEDx speaker and likes to speak in public. He is an Amateur Astronomer and Astrophotographer. He is the founding member of Karachi Astronomers Society. He can be reached at me@abubakershekhani.com.

You may also like...