Get the underlying SSRS Report Query, reset query , add your own ranges and execute report [Dynamics AX 2012, X++]


Below is the small code snippet to get the underlying query of the SSRS report, reset query, prompt the parameters form, add our own ranges and execute the report. You can customize the job as per your requirements. Below I have used CustBaseData.Report report and added my own range on customer group.

static void SR_ResetQueries_executeReport(Args _args)


    #define.reportName(‘CustBaseData.Report’) // report Name

    QueryBuildRange queryBuildRange;

    QueryBuildDatasource queryBuildDatasource;

    SRSReportRun srsReportRun;

    Query reportRunQuery;

    srsReportRun = new SRSReportRun(#reportName);


    srsReportRun.resetQueries(); // reset the query

    reportRunQuery = srsReportRun.reportQueries().lookup(srsReportRun.currentQueryKey());

    if (srsReportRun.isInitialized() && srsReportRun.prompt()) // prompt the parameters form


        queryBuildDatasource = SysQuery::findOrCreateDataSource(reportRunQuery, tablenum(CustTable));

queryBuildRange = SysQuery::findOrCreateRange(queryBuildDatasource,  fieldnum(CustTable, CustGroup));







Happy Dax6ng,

Sreenath Reddy



Display SSRS report based on customer/Vendor specific language [Dynamics AX 2012]


Common requirement is to show the reports in customer’s language [example : Quotations, sales confirmations, invoices, Free text invoices, Return order acknowledgements , Agreements,  Purchase order confirmations etc].

This was easily achievable in Dynamics AX 2009 reports by using; // language id

Well, how do I achieve the same thing  in AX 2012 SSRS Reports? image

Its simple , we still have one liner code only in AX 2012image

We need to use the controller classes, runPrintMgmt() method or preRunModifyContract() method which changes the contract class before report is run and am leaving this to you based on the requirements.


Below is the screen shot for reference:image


Happy Dax6ng,

Sreenath Reddy

Sreenath Reddy

Find and Create Invent Dim record in AX 2012 [Using X++]


I know, it has been long time, as usual Clients will always keep us busy. Just wanted to share with you the how to create Inventory Dimension in AX 2012 using X++ Code

InventDimId createInventDim(ItemId                       _itemId,

                                   InventBatchId                _inventBatchId,

                                   WMSLocationId                _wmsLocationId,

                                   WMSPalletId                  _wmsPalletId,

                                   InventSerialId               _inventSerialId,

                                   InventLocationId             _inventLocationId,

                                   EcoResItemConfigurationName  _configId,

                                   EcoResItemSizeName           _inventSizeId,

                                   EcoResItemColorName          _inventColorId,

                                   InventSiteId                 _inventSiteId



    InventTable item = InventTable::find(_itemId);

    InventDim   inventDim;



    inventDim.InventBatchId     = _inventBatchId;

    inventDim.wmsLocationId     = _wmsLocationId;

    inventDim.wmsPalletId       = _wmsPalletId;

    inventDim.InventSerialId    = _inventSerialId;

    inventDim.InventLocationId  = _inventLocationId;




        inventDim.ConfigId          = _configId;




        inventDim.InventSizeId      = _inventSizeId;




        inventDim.InventColorId     = _inventColorId;


    inventDim.InventSiteId      = _inventSiteId;


    inventDim = InventDim::findOrCreate(inventDim);

    return inventDim.InventDimId;



Happy Dax6ng,

Sreenath Reddy

Sreenath Reddy