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.


No comments: