AX 2012: LogisticsPostalAddress unknown value

Problem: I learned something new about DateEffective tables today. I had a customer requirement to store addresses in a Standard AX┬átable, PdsApprovedVendorList. So I created a relationship between my table and LogisticsPostalAddress table, adding foreign key to LogisticsPostalAddress to my table. Then I added this field to a form and set ReplacementFieldGroup property of the … Continue reading AX 2012: LogisticsPostalAddress unknown value

AX 2012: Add Custom Module to Main Menu

1. Create your custom menu under Menus in AOT. 2. Create menu reference for your newly added menu under Menus > MainMenu in AOT. 3. Drag your newly created menu to the MainMenu. 4. Save the changes. Restart the Functional workspace to see your module coming up with standard AX modules ­čÖé

AX 2012: Getting ReferenceGroup Control

Getting ReferenceGroup control automatically while dragging a datasource field to a form control is little tricky. Even if you have defined relations correctly at the table level, you might not always get the reference group control for a foreign key in the table. See the solution below for this issue. Problem: Consider for example, two … Continue reading AX 2012: Getting ReferenceGroup Control

AX 2012: Enable Disable Buttons on PurchTable SalesTable Forms

To enable/disable buttons on PurchTable/SalesTable form, you can customize their respective interaction classes: 1. Classes\PurchTableInteraction 2. Classes\PurchTableInteractionHelper 3. Classes\SalesTableInteraction 4. Classes\SalesTableInteractionHelper Let's say, for example, I want to enable the Configure line button under Product and Supply menu: All you need to do is to find and customize the right method which controls the enabling/disabling … Continue reading AX 2012: Enable Disable Buttons on PurchTable SalesTable Forms

AX 2012: Auto increment a field using LineNum

Do you want a line number field for your table just like we see the line numbers on SalesLine table on the Sales Order? if so then follow the steps below the achieve this functionality. 1. Drag LineNum EDT to the fields node of your table. 2. Create an index on your table and drag … Continue reading AX 2012: Auto increment a field using LineNum

AX 2012: Using Temporary Table as Form’s Datasource

First add a method on the form to populate records in the temporary table: public LabelsTable populateRecords() { SysDictTable dictTable = new SysDictTable(tableNum(PurchLine)); SysDictField dictField; TreeNode treeNode; LabelsTable labelsTableLocal; // Temporary table (InMemory) FieldId fieldId = dictTable.fieldNext(0); while (fieldId) { dictField = dictTable.fieldObject(fieldId); if (dictField.isSql() && !dictField.isSystem() && != "Modified") { treeNode = dictField.treeNode(); … Continue reading AX 2012: Using Temporary Table as Form’s Datasource

AX 2012: Add dynalink in X++

Use the following code to add dynalink to the form datasource query: public void init() { super(); this.query().dataSourceTable(tableNum(MzkPurchTrackingDetailsTable)).clearDynalinks(); this.query().dataSourceTable(tableNum(MzkPurchTrackingDetailsTable)).addDynalink( fieldNum(MzkPurchTrackingDetailsTable, PurchId), PurchParmTable, fieldNum(PurchParmTable, PurchId)); } Where, First parameter is the source table field Second parameter is the destination table Third parameter is the destination table field

AX 2012: Refresh caller form datasource

The following code refreshes the caller form datasource from the calling form: void clicked() { Args arg = new Args(); FormRun formRun; ; arg = new args(formstr(YourForm)); arg.record(yourTable); arg.caller(this); formRun = classFactory.formRunClass(arg); formRun.init();; formRun.wait(); formRun.detach(); YourTable_DS.reread(); YourTable_DS.rereadReferenceDataSources(); YourTable_DS.research(true); } 1. reread() -┬áRereads the current record from the database 2. rereadReferenceDataSources() - Rereads the reference … Continue reading AX 2012: Refresh caller form datasource

AX 2012: How to open a form in X++

Using FormRun: void clicked() { Args args; FormRun formRun; args = new Args(formstr(CustTable)); args.record(custTableLocal); formRun = classFactory.formRunClass(args); formRun.init();; formRun.wait(); formRun.detach(); CustTable_DS.research(); } Using MenuFunction: void clicked() { Args args; args = new Args(); args.caller(this); args.parmObject(list); new MenuFunction(menuItemDisplayStr(SalesTable), MenuItemType::Display).run(args); }