Lookup hierarchy category || AX 2012

This code shows you how to open a given category hierarchy in a lookup:   public Common lookupReference(FormReferenceControl _formReferenceControl) { Common ret; EcoResCategory  ecoResCategoryLocal;   EcoResCategoryHierarchy  categoryHierarchy  = EcoResCategoryHierarchy::find(2653334895);   ret = EcoResCategory::lookupCategoryHierarchy(_formReferenceControl, categoryHierarchy);   if (ret.TableId == tableNum(EcoResCategory)) { ecoResCategoryLocal = ret.data();   // update the current Category hierarchy if selected category belongs to … Read moreLookup hierarchy category || AX 2012

Form data source overwrite lookup || AX 2012

You can use the following code overwriting the default lookup method on a form data source field:   public void lookup(FormControl _formControl, str _filterStr) { Query query = new Query(); QueryBuildDataSource qbds; QueryBuildDataSource qbdsJoin; // Instantiate sysTableLookup object using table which will provide the visible fields SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(VendTable), _formControl); ;   qbds= query.addDataSource( … Read moreForm data source overwrite lookup || AX 2012

Get resource id from prod route || AX2012

Hey guys, here is a short codesnip for getting the resource id from the prod route. ProdRoute                       prodRoute; RecId                           recId; WrkCtrId                     … Read moreGet resource id from prod route || AX2012

Table to line update || AX 2012

    The following framework is used in AX 2012 for updating data from table to the lines when you updated the table fields. The example is for the Salestable / Salesline.   Create a new field in the SalesTable and SalesLine. Add the field to the FieldGroup HeaderToLineUpdate in the SalesTable Add the new … Read moreTable to line update || AX 2012

Create form via code || AX 2012

Sometimes it is very usefull to create a form per code. Following code demonstrates how you can do it.   form = new Form();   formTable = new DictTable(tablenum(ChangedObjects)); formBuildDataSource = form.addDataSource(formTable.name()); formBuildDataSource.table(formTable.id());   // Create the form design. formBuildDesign = form.addDesign(“Design”); formBuildDesign.caption(“myForm”); formBuildDesign.width   // Add tabbed page controls, a grid control, and string … Read moreCreate form via code || AX 2012