Prerequisites: 1. Full compile has been performed revealing no errors 2. Full CIL has been performed successfully 3. Incremental CIL has been performed after compiling the new service class To create an enhanced inbound port for your custom service, please follow the steps below: 1. Right click on the service node, CustomerService in this case,... Continue Reading →
AX 2012: Creating parm methods automatically
It is often a tedious task to create parm methods for a class having many data members. Use the following AOT job to create parm methods automatically instantaneously! All you need to do is to declare data members in the class declaration. Make sure the data type and variable is separated by a single space... Continue Reading →
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: 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() && dictField.name() != "Modified") { treeNode = dictField.treeNode();... Continue Reading →
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.run(); 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: Add financial dimension for your table
Lets quickly take a look at how the financial dimensions framework has been redesigned in AX 2012. The following picture show the table design: To add a new financial dimension for your custom table, perform the following steps: 1. Drag the EDT (AOT >> Data Dictionary >> Extended Data Types >> DimensionDefault) to the fields... Continue Reading →
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.run(); 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); }
AX 2012: this vs element | When to Use What?
In X++ we often come across an issue that we are unable to access an object member (e.g. a form method) via this keyword. Instead we CAN access the same form method via element keyword. So what's the difference between them? The difference is of the scope. To understand how it works, let's assume that... Continue Reading →