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.
Welcome to Solutions for AX DEV — a dedicated space for developers and consultants working with Microsoft Dynamics AX / D365 F&O (D365 F&O). This blog contains a collection of frequently used code snippets, development tips, and practical solutions related to AX (Axapta). Whether you're working with X++, you'll find helpful content tailored to your development needs. Have a question or need help with something Feel free to post your it.
Subscribe to:
Post Comments (Atom)
How to Disable “Advanced Filter or Sort” and Enforce Custom Filters on Any D365FO Form
In Dynamics 365 Finance and Operations, users can apply filters through the “Advanced filter or sort” feature found under the Options tab...
-
It is very common to use Like Operator in SQL SELECT column1, column2, ... FROM table_name WHERE columnN LIKE pattern ; N...
-
In the below example we will see how we can get the default financial dimension values from Purch line table. Here we are using AxdDimensi...
-
Get temp data from class to form Data source AX 2012 + X++ In the below example we will see how we can use the temporary table as form da...
No comments:
Post a Comment