lørdag den 16. november 2013

Faster compilation for AX2012 - nice

http://blogs.msdn.com/b/axtools/archive/2013/11/04/parallel-x-compilation-for-microsoft-dynamics-ax2012-r2-in-cumulative-update-7.aspx http://blogs.msdn.com/b/axtools/archive/2013/04/30/ax2012-r2-hotfix-available-improves-compile-speed.aspx http://daxmusings.codecrib.com/2013/11/what-you-need-to-know-about-15-minute.html

torsdag den 7. november 2013

Finding the cause of an incremental CIL-build error

I learned something new from one of my colleagues today, which is always nice.

I have often been irritated by the Dynamics AX 2012 CIL-builds ability to be uninformative.
The incremental CIL-build does not always tell you why it is unable to finish an incremental build, and up until today my procedure for fixing problems to be able to cil-build incrementally has been to run a complete x++ compile, which takes quite a long time.

You can examine the cause(s) of the CIL-build failure by doing the following:

1) Login on the AOS-server.
2) Find the AOS server folder
3) Go to the folder of the instance where you experienced CIL-build problems.
4) Goto folder Bin\XppIL
5) Find the file Dynamics.Ax:Application.dll.log (an example of a full path for the file could be C:\Program Files\Microsoft Dynamics AX\60\Server\DEV_AX2012\bin\XppIL\Dynamics.Ax:Application.dll.log)

In this file you can see the compile-errors which caused the incremental CIL-build to fail.

Thank God for technical sparring. :-)

fredag den 23. august 2013

My apologies.

I recently discovered that I have not been attending my mail box blog@fasor.dk. My sincerest apologies to everyone who have written to this mail box and gotten no answer. The mail box is now set up on my windows phone, and I will be answering sent to it.

fredag den 16. august 2013

How to work around best practice error: "A form that is not associated with other forms should be linked to at least one menu item"

How does one work around the Best practice error: "A form that is not associated with other forms should be linked to at least one menu item", when developing a custom lookup form ?

Developing a possibility of a custom setup on the table ReqSitePolicy, that allows for calculation of "External Invent Onhand level", I added two new extended data types:

ItemSearchInventSiteId exending InventSiteId
ItemSearchInventLocationId extending InventLocationId

and three new fields:

ItemSearchShowAvailInventDataAreaId based on EDT SelectableDataArea
ItemSearchShowAvailInventSiteId based on EDT ItemSearchInventSiteId
ItemSearchShowAvailInventLocationId (based on a EDT ItemSearchInventLocationId)

to the ReqSitePolicy table.

To be able to make lookups for ItemSearchShowAvailInventSiteId and ItemSearchShowAvailInventLocationId fields based on the legal entity chosen in the ItemSearchShowAvailInventDataAreaId field (even though the currently active legal entity might be something else), I prepared two custom lookup forms for the EDTs ItemSearchInventSiteId and ItemSearchInventLocationId. The querys of the custom lookup forms have the property CrossCompanyAutoQuery set to YES.

The custom lookup forms uses the legal entity chosen in the ItemSearchShowAvailInventDataAreaId to make a crosscomapny lookup for InventSiteId and InventLocationId, clearing dynalinks and doing:

this.query().addCompanyRange(dataAreaIdCriteria);

in the executeQuery-method of the datasource of the lookup form.

However compiling the lookup forms resulted in the best practice error: "A form that is not associated with other forms should be linked to at least one menu item".

Well, to solve that problem open the lookupform in the - AOT-path:

Form / "custom lookup form name" / Designs / Design.
Set the "Style" property to "Lookup".

And poof the Best Practice error has gone away.

fredag den 9. august 2013

Modal forms in Dynamics AX

Some years ago, I wrote on this blog of a method to make a form modal in the AX client. The solution was made on Axapta 3.0 and involved calling winapi unmanaged. Someone commented that the method I described was bad code, because he had experienced a computer crash while debugging something that involved the code.

Mindaugas Pocius has suggested a method in his Dynamics AX cookbook books Dynamics AX Cookbooks where the windowtype is set to Popup. This ensures that the form is on top but not that the form you want to be modal, is the only one that is active, so using Mindagaus' method, you are able to leave the form that is "modal".

Now a colleague of mine has found a very simple solution. His scenario was this. From a form you can click a button that opens an other form. This form that is opened must be ontop and the only form in focus and active until you either click OK or CANCEL in this form.

The calling form includes a button, that open the form to be modal. The called form / modal form includes a simple command ( element.wait(true); )in the run method of the form:

public void run()
{
    super();
    element.wait(true);
    // Execution will resume at this point, only after
    // the user has closed the form.
}


So in essence the form you that is modal is in essence waiting for it self to be closed, before the execution path is returned to the calling form.

fredag den 5. juli 2013

Very small and simple tool to use when comparing code in different AX environments

Some time ago I was was given the task of determining the differences in codebase between three different AX environments, running AX 2012 RTM.

You might ask why would this be necessary, if you follow best practices that code is always moved from DEV to TEST, from DEV TO STAGING, and from STAGING to PRODUCTION, the only differences would be new ?

Well, sometimes it is just not possible to test and correct a data problem that the users have in PRODUCTION by having the data rolled back into DEV within the timeframe given to solve the problem, and this leads to someone making hotfixes in the code directly in PRODUCTION. I know, I know - NOT recommendable.

However the situation was that noone was exactly sure that the codebase in the environments were aligned, and wanted to know if there were any differences and where.

Enter Araxis Merge, which is a wonderful tool for comparing and merging text-files. The advantage Araxis has over Dynamics AX's own compare tool are several:

  • Better visual indication of differences
  • Better merging possibilities
  • Three way comparison
  • Three way comparison of files in directories


Especially the last item on the above list came in VERY handy in my case.

I wrote a very small AX class, that simply scanned the AOT-layers that had been used for customization for any customized elements. When finding one it simply exported it naming the file with the following convention: "Layer"-"ElementType"-"ElementName".xpo

This produces a number of .xpo-files (one for each customization found in the AOT). Now I ran the class for each of the three environments producing files for DEV, TEST and PROD.

I then put the files from each environment in a separate folder on my disk, and asked Araxis to do a folder comparison. And voila:

(note that the example shown in the picture only contains a two way folder comparison).











Araxis shows you a list where it has first compared the folders and it shows if there are files missing (customized elements) in one of the folders (environments) with a grey or green color. The purple color indicates that the element is there in both environments, but if the element is different in one environment it has been marked with a small red square. On these lines you can click on the element, to open a file compare, where you have merging possibilities.











Here you can find the class that does the export.

Ax Class:AOTExport

In future it will be exciting to see if Microsoft Dynamics Lifecycle Services will bring possibilities/tools regarding issues like this one.

lørdag den 15. juni 2013

Showing hidden fields in the table browser

A request for the possibility of showing the contents of hidden fields in Ax tables, using the table browser, made me do a google search, to avoid reinventing the wheel.

Sure enough Vilmos Kintera had adressed the problem earlier on http://daxrunbase.blogspot.dk/2010/04/non-visible-fields-in-table-browser.html. And he has done good work. :) Keep it up Vilmos.

Running the customized table browser seemed to work fine in AX 2009, however I ran into issues using it in AX 2012. I tested the customized table browser on the table CustTrans, which was the table I first found to contain hidden fields and I got a run-time error.

Investigating the problem I found that the reason in seemed to run fine on AX 2009 (using CustTrans table) but failed in AX 2012 on the same table, was due to a small issue that Vilmos hadn't adressed, namely Extended Data Types defined as Arrays.

The .ds datasource on the SysTableBrowser form had it's active method customized to populate the new lower grid, with rows showing the contents and "identity" of each hidden field. The method contains a switch case construction takling care of all intrisic types, and the default (no type found) simply attempts to convert the field value of the field in question to a string. However the issue was that fields based on Extended Data Types defined as arrays were not handled causing a run-time error.

I hacked this to make a further branch in the default case, checking if the arrayindex of the field in question is greater than 1, indicating that the field is based on an EDT defined as an array. If the field in question is an array, the hack iterates each array element and creates a row in the lower grid for each found array element.

The reason why everything seemed to work fine i AX 2009 was that DIMENSION fields were EDT's defined as arrays but in AX 2012 everything changed regarding financials dimensions, as you might know. In 2009 and previous versions Dimension fields were never hidden, as they were of course used. But in 2012 the old Dimension-fields are prefixed with DEL_ and put in the Obsolete... configuration key to be deleted in next upgrade.

The problem I encountered in CustTrans were due to the abovementioned. The customized table browser ran fine in AX 2009 because the Dimension field was in use and not hidden. However in AX 2012 this was not so, so the code could not handle the hidden Del_Dimension field (or indeed any array based field).

However the code WOULD have failed in 2009 also if anyone had browsed a table with a hidden array field. I tested this by setting the visible property of the Dimension field in an AX2009 to false, and browsing with Vilmos' customization and the result was a run-time error.

So here is my own modified version of Vilmos' tablebrowser.

AX 2012 - .xpo-file

AX 2009 - .xpo-file

Disclaimer: Use this code at own risk !!! This blogger can in no way be made responsible for data loss or damages that follows using this code.

tirsdag den 5. marts 2013

Yes I know it's small chance of ever winning, but if you don't play you have no chance of winning.

Firebrand Training is giving you the chance to win free training for a life time, and who wouldn't want that as a price. :) Please click Firebrand Training to enter the competetion your self.

onsdag den 2. januar 2013

Fixed assets DAX 2012: Missing value models in lookup

Having trouble with missing value models in lookup in Fixed Assets module.
Try running the class

AssetRebuildTables


The EDT AssetBookMergeId defines either a value model or a depreciation book.
This EDT is related to a table called AssetBookMergeLookup.

I experienced that this table had been "corrupted", so that one of the value models were not available in the lookup.

I ran the AssetRebuildTables class from the AOT, and voila.
The table was rebuilt for me.