Tuesday 24 June 2008

Creating new NumberSequences in AX (Existing Modules)

Creating new NumberSequences in AX (Existing Modules)
Suppose you have created a new Form (Employee) in HRM Module and want to set up NumberSequences on that form.
Here is what you do:1. Create a new EDT called mk_empNumEDT.
2. Create a Table mk_EmployeeTable using this EDT.
3. Create a relation on the EDT.
4. Append \Classes\NumberSeqReference_HRM\loadModule() method and add the following code at the end
//==========================================numRef.DataTypeId = typeId2ExtendedTypeId(typeid(mk_empNumEDT)); // The new EDT you madenumRef.ConfigurationKeyId = configurationkeynum(Your Config Key); // Any Configuration key you madenumRef.ReferenceHelp = literalstr("Your label."); // Label you want to appear on the Parameters FormnumRef.WizardContinuous = true;numRef.WizardManual = NoYes::No;numRef.WizardAllowChangeDown = NoYes::No;numRef.WizardAllowChangeUp = NoYes::No;numRef.SortField = 12; // Sorting on the Parameters FormnumRef.WizardHighest = 999999;this.create(numRef);//==========================================

5. Goto \Basic\Setup\Number sequences\Number sequences and create a new record.
6. Goto \Menus\Basic\Setup\Number sequences\References and select Number sequence code created in step 5.
7. Create a new Method in the mk_EmployeeTable created.\Data Dictionary\Tables\newTable\Methods\ initValue ()
//==========================================public void initValue()
{
this.EmpNum = NumberSeq::newGetNum(NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(mkEMPNum)))).num();
// this.EmpNum = NumberSeq::newGetNumFromCode('Huma_136').num();// second option we can use.
super();
}//==========================================
8. Create a form and add this table to data source and use it.

Update NuGet package to new MS D365FO version

1. Import the NuGet package files from LCS for that particular version please take the PU version files only. a. Goto LCS-->Asset Libra...