GoogleAnalyticsObject

onsdag den 29. april 2015

Auto Create Classes

I think we all have this little archive of code that we use again and again in AX.

So i have made to different tools for handling these code snippets, and here is the first one of them, the Auto Create Class tool.

So really simply told when you run the Class, you select witch Class type to generate, then the name and/or further parameters for the Class you are making.

At the moment the Class can create these Class Types:

  • Std_Run,  Simple class with Main and Run methods.
  • Std_DialogBatch,  Class that can run in Batch and has a Dialog
  • Std_Exp2Excel,  Class for exporting data to Excel, typically a Table, but could be anything.

But i hope to add on to this list as more stuff comes up, if you have any ideas write a comment with it, and i will have a look.

If you want to use this tool you can download a zip file with the tool from the links below.
The Zip file contains,
  • 1 project export file with the elements needed in AX (PrivateProject_DevCreateClasses.xpo)
  • 3 xpo's with exports of the templates for the Standard Classes.
The 3 xpo files are needed for the Class as templates for the Classes it needs to create, so you need to keep them in a Folder you have access to from the AX Client.
You will need to make one correction in the classDeclaration of the DevCreateClasses Class.

You will need to change the file location in line 4 to where you have put the xpo's
This is how the line looks in the method:
    #define.ExportFilePath(@'C:\TEMP\DevCreateClasses\')


---------- Download ----------
For Dynamics AX 2012 (link)

---------- Problems / Errors ----------
The Class still needs work, so it's a little messy, sorry about that.
AX 2009 version missing.


Please remember to leave a Comment it you like this article, have questions for it, or have something else you would like me to write about.

fredag den 20. marts 2015

Windows Service that accesses Dynamics AX

So i saw this question from Eitan Mizrahi on the Microsoft Dynamics AX Community ( link )
And thought i would make an attempt to make an Windows Service that calls Dynamics AX and gets some data back from it.

For now the code is really simple, just the bare minimum, connect to Dynamics AX, call a class and receive the result in a string.

But its a good starting point, so any thing can really be build on top of it.

Download Visual Studio 2010 code ( link )

Three things you have to remember in Visual Studio, i have done it in the project but you might need to check on the reference.

  1. Add a reference to Microsoft.Dynamics.AX.ManagedInterop.dll file, its usually found in the sub of your Dynamics AX installation under \BusinessConnector\Bin\
  2. Change the Target Framework to .Net Framework 2.0
  3. Change the Platform Target to x64 (So this code will only work on a 64bit machine)

As a help to make this i used the code Eitan Mizrahi put in the question on the forum, and this Youtube video on making a Windows Service in Visual Studio ( link )

I hope you can use this code, and feel free to leave a comment with suggestions for what i should change, or anything you would like me to look at next.

With Reguards
--Rudi Hansen

fredag den 20. februar 2015

The Code Profiler in Dynamics AX

The Code Profiler in Dynamics AX is a powerful tool for finding performance issues in the application.

But it can also be a little difficult to use simply just because of the overwhelming amount of data it creates, so sometimes it's nice to limit the amount of code it runs on.

This is where the macro #profileBegin comes in really handy.

If you already know the place in your code that runs slow, you can put in the macro before and after, and then the profiler only runs on that piece of code.

Example:
       
       
       public void  printJournal(Set _journalList)
       {
           /*
            . Cut out code
            .
            .
           */
               {
                   #profileBegin("printJournal")    // RSH Start profiling code
                   this.sendAsXML();
                   this.doPrint();
                   #profileEnd                      // RSH End profiling code
               }
           }
       }
       
 

Now you only profile the code you actually need to measure, and not allot of unnecessary code.

Beta versions of Dynamics AX

So one of my thoughts when Microsoft bought the company Navision, and with that company the product we today knows as Dynamics AX, was YES now we will finally get beta versions of the product just like the Visual Studio developers of the world gets beta versions of that product.

But unfortunately that did not happen, we as developers only get access to the product when its ready to be sold.

And i do not understand why this is the case, is there any good reason why Microsoft is not letting us get early access to beta version of AX?

Please let me know what your thoughts are?