Skip to main content


Showing posts from April, 2014

AX 2012 / AX 2009: Layers object

Hi folks J today am going to illustrate the sample code which helps you in finding all the different objects in the specified layers.
So Running the below code opens a dialog wherein we can select the layer as shown:

static void LayerObjectsAX2012(Args _args) {     #AOT     treeNode treeNode;     xInfo xInfo = new xInfo();     UtilElements utilElements;     str layer;     int counter = 0;     textBuffer textBuffer = new textBuffer();     dialog dialog = new dialog("Find the modified objects");     dialogfield layerTypeDf;     ;     layerTypeDf = dialog.addField(enumStr(utilEntrylevel),"Choose the layer");     if(     {         treeNode = treenode::findNode(#TablesPath);         treeNode = treeNode.AOTfirstChild();
        while (treeNode)         {            if(SysTreeNode::existsInLayer(treeNode, layerTypeDf.value()))            {
             textBuffer.appendText(treeNode.AOTname());              textBuffer.appendText('\n');              counter ++;          …

Microsoft Dynamics AX 2012 X++ Editor Extensions

AX2012: Open Word Application through X++

Just a small snippet to demonstrate, how we can open Microsoft word application through X++.
And this would be really significant when you want certain things to move from AX to Word for example print screen of AX forms to MS Word.
And here is the code:
Ex#1: static void OpenWordTemplate() {   COM wordApp;   COM wordDocuments;   wordApp = new COM("word.application");   wordDocuments = wordApp.Documents();
  wordDocuments.Open("c:\\CustomerDocument.docX");   wordApp.visible(true); }
Ex#2: static void WordSaveAs() {
  COM wordApp;   COM wordDocuments;   COM wordDocument;   COM wordRng;
  wordApp = new COM("word.application");   wordApp.visible(false);   wordDocuments = wordApp.Documents();   wordDocument = wordDocuments.add();   wordRng = wordDocument.range(0,0);   wordRng.insertafter("Customer account information");
  wordApp.visible(true); }

Happy Dax6ng J