Monthly Archives: September 2016

Add AX FormGroupControl runtime

Apparently you cannot populate a form data group runtime in AX. I have been able to overcome the issue by adding the controls dynamically. In this example I have created a form with InventTable as the datasource, and added a FormGroupControl called FormDataGroup with AutoDeclare = Yes. Then I have overridden the executeQuery() on InventTable_ds to call my custom method stored on the form. Here is the source to add AX FormGroupControl runtime from code:

public void WIK_addFieldGroup()

    TreeNode            fieldGroupRoot = TreeNode::findNode(strFmt('%1\\%2\\Field Groups\\%3',
        tableFieldgroupStr(InventTable, Name)));
    TreeNodeIterator    tni = fieldGroupRoot.AOTiterator();
    TreeNode            fieldGroupNode = tni ? : null;
    int                 fieldNo;
    DictField           dictField;
    FormControlType     controlType;
    Object              formControl;
    while (fieldGroupNode)
        fieldNo = (select firstOnly AxId from SysModelElement
            where  SysModelElement.ParentId     == tableNum(InventTable)
                && SysModelElement.ElementType  == UtilElementType::TableField
                && SysModelElement.Name         == fieldGroupNode.AOTname()).AxId;
        dictField = new DictField(tableNum(InventTable), fieldNo);
        if (!dictField)
            // display method in field group
            fieldGroupNode =;
        switch (dictField.baseType())
            case Types::Int64 :
                controlType = FormControlType::Int64;
            case Types::Integer :
                controlType = FormControlType::Integer;
            case Types::String :
                controlType = FormControlType::String;
            case Types::Date :
                controlType = FormControlType::Date;
            case Types::UtcDateTime :
                controlType = FormControlType::DateTime;
            //TODO: Implement all field types

        formControl = formdatagroup.addControl(controlType, strFmt('InventTable_%1', fieldGroupNode.AOTname()));

        fieldGroupNode =;


By |2016-09-21T12:20:54+02:00September 21st, 2016|Categories: AX 2012|Tags: , , , , |3 Comments

AX License Configuration details

In older versions of AX we could see additional details under System administration > Setup > Licensing > License configuration that has been missing from the more recent versions. Here is an update done in version 2012 R3 to have better AX License Configuration details by showing the configuration key name in the AOT, the application layer and the model:

AX License Configuration details

The heart of the code is as per below to populate the 3 form controls, called in the Tree.selectionChanged() method:

public void WIK_setElement()
    int                     idx             = Tree.getSelection();
    FormTreeItem            node            = Tree.getItem(idx);
    boolean                 isValidLicense  = node && !node.overlayImage();
    ConfigurationKeyName    configKeyName;

    SysModelElement     elementNode;
    SysModelElementData elementData;
    SysModelManifest    model;
    SysModelLayer       layer;

    if (isValidLicense)
        configKeyName = configurationkeyId2Name(Tree.getItem(idx).data());

        select firstOnly Name from model
            join elementNode
                where  elementNode.Name         == configKeyName
                    && elementNode.ElementType  == UtilElementType::ConfigurationKey
            join elementData
                where  elementData.ModelElement == elementNode.RecId
                    && model.Model              == elementData.ModelId
            join Layer from layer
                where layer.RecId   == elementData.Layer;

    WIK_LicenseConfig.text(isValidLicense ? configKeyName : '');
    WIK_LicenseLayer.text(isValidLicense ? enum2Symbol(enumNum(UtilEntryLevel), layer.Layer) : '');
    WIK_LicenseModel.text(isValidLicense ? model.Name : '');

Here is the XPO of the changes:

By |2016-09-19T12:27:23+02:00September 19th, 2016|Categories: AX 2012|Tags: , , , |1 Comment

Deploy all SSRS reports ignoring errors

If you try to bulk-deploy the SSRS reports from any sources (AX, VS, PowerShell) and you are not using OLAP cubes with SSAS, the deployment will fail with the error message below. Feel free to use this job to deploy all SSRS reports ignoring errors.

Microsoft.ReportingServices.Diagnostics.Utilities.InvalidItemPathException: The path of the item ‘/DynamicsAX/’ is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash.

static void WIK_deploySSRSreports_SkipError(Args _args)
    TreeNodeIterator        reportIterator = TreeNode::findNode(#SSRSReportsPath).AOTiterator();
    SRSReportManager        srsReportManager = new SRSReportManager();
    SSRSReportConceptNode   ssrsReportConceptNode;
    if (!reportIterator)
    ssrsReportConceptNode =;
    while (ssrsReportConceptNode)
        ssrsReportConceptNode =;


By |2016-09-05T16:23:17+02:00September 5th, 2016|Categories: AX 2012|Tags: , , , , |1 Comment