Showing posts with label AX2012. Show all posts
Showing posts with label AX2012. Show all posts

Sunday, March 29, 2015

Pulling source code from the AOT in Dynamics AX2012


There may come a time when you want to pull the source code to a class method out of the AOT by using XPP.  This can be accomplished by pulling the AOT source code out of the tree node of an object in the AOT as follows:

static void GBS_JEH_ShowCode(Args _args)
{
 
    TreeNode tn;
    str code;
    ;
    tn=TreeNode::findNode(@'Classes\ExchangeRateProviderFixer\classdeclaration');
    code = tn.AOTgetSource();
    info(code);

}

Of course for the code to work, you would have to have an ExchangeRateProviderFixer class in this scenario, so choose your own class and substitute accordingly.


Result of job execution


It would be interesting to iterate through the AOT , pulling out all the source code in the nodes to see what we come up with.


Debugging a Dynamics AX2012 SSRS RDP Report


I haven't put my finger on it yet, but there are times when I am unable to debug an SSRS RDP Report.  I add my breakpoint but during code execution, the system just won't break when it should.  I believe this is related to how the classes are extended.

While faced with this delima, I did some research on the internet and found an article which shows how to create a job for debugging purposes.  Please follow this link for the original reference: Test Report Data Provider in AX2012.

The following is a simple job to invoke an SSRS RDP report.  It doesn't actually print the report, but it does do the meat of the processing so you can debug your RDP code.  Substitute your RDP class and Contract information as required.

static void Job3(Args _args){
TmpABC tempTable;
InventABCDP dataProvider = new InventABCDP();
InventABCContract contract = new InventABCContract();
contract.parmABCModel(ABCModel::Link);
contract.parmCategoryA(10);
contract.parmCategoryC(20);
contract.parmCategoryB(70);
contract.parmInterest(2.5);

dataProvider.parmDataContract(contract);
dataProvider.processReport();
tempTable = dataProvider.getTmpABC();

while
 select tempTable
{
info(tempTable.ItemName);
}
}