Wednesday, October 5, 2016

Why you can't find any delete actions for the DocuRef table in AX7

There aren't any...

In AX7 clean up of records in DocuRef is handled by a recurring batch job. The batch job is automatically created during AX initialization when you deploy a new solution. The batch job is listed as "Scan for orphaned document references" and it is scheduled to run every sixth hour.

I can't find the job between the batch jobs in the demo data though. But you can add it by calling the loadData method of the class DocumentManagementSetup.

Thursday, September 29, 2016

Setup a keyboard shortcut on the WMS mobile device portal

You can setup keyboard shortcuts for the mobile device portal without any code changes at all. Here is in short what you need to do.

You need to know two things before you can setup the shortcut:

  1. The HTML id of the button type to create the shortcut for.
  2. The JavaScript keyboard code for the key you want to use.
You find the HTML id of the button type by looking at the HTML source behind it. In Internet Explorer you right click a button of the type and select "Inspect element":

Then you can find the HTML id here:

The JavaScript keyboard code you can find from this menu item (sorry, the screenshot is in Danish, but it should say something like "Show codes for keyboard short cuts"):

When you have clicked the menu item, just hit the key you want to use and it will show the keyboard code:

Here I have hit the escape key and got code 27 for that.

Now you need to decide how to show what the keyboard shortcut is shown as. That is added to text of the button. In this case I'll show it as "ESC".

To enable the escape button  for "Cancel", I can enter the following setup in "Work user mobile display settings":
So this is "HTML id"("text to show in the button")="keyboard code"

And it'll look like this:

Here is a good article from Microsoft explaining the setup:

Friday, September 2, 2016

The Microsoft Dynamics AX Help Wiki is getting a lot of good content these days

The last few days and weeks a lot of good documentation has been added to the Wiki. If you want to follow new articles you should subscribe to the RSS feed.

And by the way, a lot of the X++ documentation also applies to older versions than AX7.

Friday, August 12, 2016

Don't change the name of a Form instance in AX 7

In AX 2012 you could do something like this, where you change the name of a Form instance:

form = new Form(formstr(MyPrettyForm));"AnotherNameToConfuseEverybody);

args = new Args();

formRun = classfactory.formRunClass(args);

In AX 7 changing the name seems to confuse AX to a sense where it can't figure out to actually run eventual code in (at least) the init and run methods of the form.

For many reasons I think it is a poor idea to change the name of a form instance, now there is also a technical reason not do it.

Wednesday, August 10, 2016

Public members vs. Parm methods on classes extending SysAttribute in AX 7

I thought I did the right thing when I changed attribute classes that I moved into AX 7 from AX 2012, so they had public members instead of Parm methods.

Well, don't do that. As it turns out the attribute framework is looking for the Parm methods when trying to apply the member values. If you don't have them, the values are not being set.

Hopefully this information can save you an hour or so of tedious debugging.