Skip to main content


Showing posts from December, 2013

Default dimensions in AX 2012

Creating default dimensions for vendor or customer through X++:
Created a class called “FindOrCreateDefaultDimension” and then utilizing its method “findDefaultDimension” whenever default dimension is required.
Suppose I’ve 6 dimension out of which 3 are custom dimension and rest are standard ones. For custom dimension am including ‘FinancialDimensionTag’ Table in to the while loop. As shown below

Static DimensionDefault findDefaultDimension(str _Department, Str _BusinessType,str _AnchorTenant, Str _Category,str _SiteId, str _costcenter, str _purpose) {
    Struct                          struct = new Struct(); container                       defDimensionCon;     DimensionDefault                dimensionDefault;     DimensionAttributeSetItem       dimAttrSetItem;     DimensionAttribute              dimAttribute; int i;
//Loop for required dimensions whileselect Name, BackingEntityType from dimAttribute where dimAttribute.BackingEntityType == tableNum(DimAttributeOMBusinessUnit) ||               di…

Financial Dimension - Lookup in AX 2012 R2

Look up to provide all the custom dimension (Even can be used in SSRS reporting using UI Builder classes)
publicvoid lookup() {     Query           query;
    SysTableLookup  sysTableLookup;
    sysTableLookup = SysTableLookup::newParameters(tableNum(DimensionAttribute), this);
    sysTableLookup.addLookupfield(fieldNum(DimensionAttribute, Name));
    query = new Query();
    addRange(fieldNum(DimensionAttribute, Type)).
    sysTableLookup.performFormLookup(); }
And the now another lookup which gives us the value corresponding to the dimension selected in above lookup. We can implement it either in forms or dialog (can also be used in SSRS reporting using UI Builder classes).
publicvoid lookup() {     DimensionAttribute                  dimensionAttribute;
    DimensionAttributeDirCategory       dimAttributeDirCategory;
    Query                  …

AX2012R2: Creating Financial Dimension Combination

In AX 2012 there are a couple of different ways you can programmatically create combinations of dimensions.  These combinations are saved as records in the DimensionAttributeValueCombination table.  The RecId from the DimensionAttributeValueCombination table is what is saved in the LedgerDimension field on the LedgerJournalTrans table.
The first and best way to create dimension combinations is to use the class and method DimensionServiceProvider\buildDimensionStorageForLedgerAccount.  The buildDimensionStorageForLedgerAccount method takes a
LedgerAccountContract class.  In the LedgerAccountContract class there are two parm methods, parmMainAccount and parmValues.  The parmMainAccount method takes the MainAccount like ‘10060’ and the parmValues method takes a list of the other dimension values you want to set.  More specifically the parmValues method takes a list of classes.  The classes are of type DimensionAttributeValueContract.  On the DimensionAttributeValueContract class you set …

Dialog in AX 2012 (MultiSelect control in Dialog):

Hi, let me walk-through the dialog feature in AX 2012.
Sometime when developing complex functionality, Dialog plays a significant role. Creation of dialog always provide you lot of standard features such as standard dialog form throughout ax, batch tab under form, validations, pack – unpack to persist the last storage value, to select query values(SysQuery form) etc.. Illustrating the dialog in AX2012 – Creation of dialog fields using standard dialogfield methods (which gives us lookup using EDT) or get custom lookup using formbuild control under the dialog and also get an benefit of having multi select under lookups. At the same time we can also achieve Sysquery form (Select button) under the dialog through classes.

We can have multi select control for dialog field using code below:
class VT_DialogEx extends RunBaseBatch {     DialogField                 df, df1;     CustAccount                 ct;     DialogGroup                 dfg, dfg1;
    CustAccount                 dfval;
    QueryRun …

AX2012 R2: Creating Product or Product Master through X++

staticvoid CreateEcoResProduct(Args _args) {     EcoResEcoResProduct_TrackingDimGroup        tracDimGroup;     EcoResEcoResProduct_Product_Master          productMaster;     EcoResEcoResProduct_Product_Distinct        distMaster;     EcoResEcoResProduct_ProductDimGroup         prodDimGroup;     EcoResEcoResProduct_StorageDimGroup         storDimGroup;     EcoResEcoResProduct_translation             translation;     EcoResEcoResProduct_Identifier              identifier;     EcoResProductService                        ecoProdSvc;     EcoResProductNumber                         lEcoResProductNumber;     NumberSequenceTable                         numberSequenceTable;     EcoResEcoResProduct                         ecoResProd;     EcoResProductType                           ecoResProductType; boolean                                     isMaster = false;     EcoResProductSearchName                     _ecmProductName;     EcoResProductSubtype                        prodSubType;     ;
    prodSubType = EcoR…