Friday, March 16, 2012

How to open a form in a running AX client from an external application

You can call the various startup commands in AX from an url like "dynamics://0/?".

Check this article for an overview of how to do it, and to get startup command code to open a specific form:
http://axcoder.blogspot.com/2010/10/how-to-open-form-in-running-ax-from.html

I have tried to create another pipe in order to make my own implementation of the pipe handling, but it seems like anything else than the pipe name for Events is ignored.

Monday, March 12, 2012

Preventing users from opening new workspaces

In AX 2009, before hotfix roll-up 6, AX has some issues when users open multiple workspaces with different company accounts.

I have seen issues where voucher numbers were pulled from the wrong company account and I have seen a data import going totally awry.

You can't completely prevent users from opening new workspaces through the security model, but you can add code that immediately closes these aging. Add the the following code to \Classes\Info\workspaceWindowCreated:

void workspaceWindowCreated(int _hWnd)
{
;
    // Put workspace window specific initialization here.
    // Begin -->
    if(xInfo::currentWorkspaceNum()>1)
    {
        Infolog.shutDown(true);
    }
    // End <--
}

Report Developer Resources

TJ Vassar has made a great list over report developer resources, that I'd like to share:
http://blogs.msdn.com/b/dynamicsaxbi/archive/2012/03/09/collections-report-developer-resources.aspx

Friday, March 9, 2012

AX 2012 "Doh" upgrade experience

When preparing to upgrade your code by importing an old layer from the previous version, make sure that you don't import any changes to the SysCheckList classes.

If one of these won't compile on AX 2012 you're kind of stuck, unable to start AX properly until you uninstall the new model again.

Monday, March 5, 2012

AX 2012 upgrade tip for lazy idiots like me

I didn't read the upgrade material carefully enough, and imported the upgrade framework to my AX 2009 application, before activating multisite in all companies. Now there's an issue with one of the tables of the framework, preventing me from activating multisite.

At this point I could of course uninstall the upgrade framework again, but my laziness is in the way of that solution.

Adding the table to the list of tables the multisite activation wizard shouldn't concern itself with seems to fix the problem:


Use this tip at your own risk.

I'd however like to consider myself a bit excused, when the upgrade guide contains the following statement:


Friday, February 10, 2012

Inserting code snippets in the AX 2012 X++ editor

In the AX 2012 X++ you can quickly insert fragments of code to avoid tedious typing, such as typing for a loop.

To insert a snippet, you must enter the snippets alias (which is usually the first symbol of the code), and press tab. For example, typing switch followed by tab, gives you this snippet:
switch ()
{
    case :
        break;

    case :
        break;
}

I don't have a clear picture of all the available aliases, but these work:
  • switch
  • for
  • do
  • while
  • try
In the regular Visual Studio editor you can add your own code snippets. I haven't figured out yet, if this is also possible for the X++ editor.

UPDATE: Brandon, a fellow blogger, wrote a great blog post about these scripts: AX 2012 - xppSource Exposed: Inserting code snippets

Preventing client crashes when applying new event handlers

Almost every time I create a new pre- or post-event handler and try to use use it immediately on a new Event Handler Subscription, the AX client crashes.

You can prevent these crashes by saving the event handler class and restoring it, before addressing it on a new Event Handler Subscription. Restore is placed on right click / Restore.