Tuesday, May 20, 2014

Expressions in the query dialog

Pressed for an answer from a customer, I today tried something that I don't think I have tried before, and that is to use a query expression directly from the query dialog. To my surprise it actually works.

Below screenshot is from AX 2009, but it also works in AX 2012.

Read more about query expressions here.

Enhanced Session Mode in the new AX2012 R3 demo Hyper-V

The new demo image supports Enhanced Session Mode, which gives you a more Remote Desktop like connection when you connect directly from the Hyper-V Manager. For example you can choose a screen resolution.

Read more about Enhanced Session Mode Overview.

Sunday, May 11, 2014

Read mails from a POP3 account with AX

Often when you browse lists of new AX features and AOT objects, you stumble across something that makes you a bit curious.

In R3 I came across some Brazilian functionality where AX connects to an e-mail account, fetches some official government issued files and processes these.

So AX can read e-mails, eh!?

Oh yes, and the Brazilian stuff is backed by a very nice basic framework for doing so.

Here is a very simple piece of code to show how it works.
static void Job1(Args _args)
    SysEmailAccount         sysEmailAccount;
    SysEmailAccountList     sysEmailAccountList = SysEmailAccountList::construct();
    SysEmailReader          sysEmailReader      = SysEmailReader::construct();
    SysEmailMessageReadList sysEmailMessageReadList;
    SysEmailMessageRead     sysEmailMessageRead;
    // Setup the account
    sysEmailAccount = SysEmailAccount::newAccount('', '', 'your_password', 995, true);
    // Add the account to a list of accounts to be checked
    // Get a list of unread meassages
    sysEmailMessageReadList = sysEmailReader.getUnreadEmailMessages(sysEmailAccountList);
    // Loop over the list of unread mesages
    while (sysEmailMessageReadList.moveNext())
        // Get the current message from the message loop
        sysEmailMessageRead = sysEmailMessageReadList.current();
        // Work with this message(show the subject line)
        info (sysEmailMessageRead.parmSubject());
In a production environment you should of course not keep your account and password in clear text. Look into how the framework works with encrypted values for these, by checking the Brazilian feature.

I tried to test this with my account. If you do that and you have two-step verification turned on, you need to turn off two-step verification while testing or create a new app password to login with. Remember to enable two-step verification again if you disable it.

Also I tried to read messages with the Danish letters "ÆØÅ" - that didn't come out nicely. You probably need to do some extra work with the received text to set the right encoding. I didn't look into this and I'd love to hear if someone does.

In AX under "System administration / Setup / System / E-mail client constraints" you can find some setting of importance to this feature.

Thursday, May 8, 2014

Microsoft Dynamics AX 2012 Reference: Tables and Table Groups

This new spreadsheet includes the name, table group, table type, whether the table is a system table, whether the table is visible in the Application Object Tree (AOT), and whether the table is shared.

Download it from here.

Tuesday, May 6, 2014

Cross reference update never finishing on AX 2012 R2

I had a development box where I just couldn't get a cross reference update to finish. Even letting it run for days didn't help.

I finally got to run a SQL trace on what was going on. A thing that I probably should have tried a lot earlier. From the trace I could see that the cross reference for some reason was in an infinite loop on a particular form. I checked over a few hours and it never did seem to get past that form.

I killed the process and started a new cross reference agin, but this time I deleted the existing cross reference first:

When that was finished, I started a new cross reference update with the "Update all" option checked and this time cross reference was updated within the expected time frame.