Display String as barcode

There are several different classes in AX which can convert a simple string to a specific barcode format. I used the following example to convert a string to a EAN128 barcode and display it in a simple dialog in AX2012R3: Which font code you need is declared in the classes “Barcode*” classes. You can initialize … Read moreDisplay String as barcode

Active InventDim dimension on ListPage

If you want to check on a list page if a specific inventDim dimension is active and shown on the grid the following code can check that case: (The example checks if the invent batch id is displayed on the grid:   if (element.inventDimSetupObject().parmDimParmVisibleGrid().InventBatchIdFlag) { // Display some new field }  

Unit conversion

Simple code for converting between two units: unitOfMeasureInvent = InventTableModule::find(itemId, ModuleInventPurchSales::Invent).UnitId; if (unitOfMeasureInvent != unitOfMeasure) { convertedQty = UnitOfMeasureConverter::convert(qty, UnitOfMeasure::unitOfMeasureIdBySymbol(unitOfMeasure), UnitOfMeasure::unitOfMeasureIdBySymbol(unitOfMeasureInvent), NoYes::No, InventTable::itemProduct(itemId), NoYes::No); }

Complete specific work line

WHSWorkTable workTable; WHSWorkLine workLine; WHSWorkExecute workExecute = new WHSWorkExecute(); WHSWorkCompleteForm workcompleteForm = new WHSWorkCompleteForm(); WHSWorkManualComplete manualComplete = new WHSWorkManualComplete(); select workTable where workTable.WorkBuildId == _workBuildId; select forUpdate workLine where workLine.WorkType == WHSWorkType::Put && workLine.WorkId == workTable.WorkId; if (workLine) { ttsBegin; workLine.WorkStop = true; workLine.update(); ttsCommit; } else { throw error (“@SYS111591”); } if (_toLocationId) { … Read moreComplete specific work line

Get values for attribute from product

For getting the values for the product attributes you can use a simple view in AX:   EcoResProductAttributeValue attributeValue; // View select attributeValue       where attributeValue.Product == _product           && attributeValue.Attribute == resultAttribute.RecId; After that you can use the value RecId for finding the related value table.  

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