Tuesday, February 1, 2011

Dynamics AX Easter Egg

Jacob found an Easter egg in Dynamics AX! Try to create and run the following job:-
static void AXEasterEgg(Args _args)
{;
    info(conPeek(new HeapCheck().createAContainer(), 4));
}
A Danish message will be displayed “Hej Mor, her kommer en buffer”. Google Translate this into “Hi Mom, here comes a buffer”. Interesting...

Original post here from Jacob:- http://gotdax.blogspot.com/2010/11/dynanics-ax-wtf.html

AX 4.0 client slow in startup / logon

On a fresh AX 4 installation (yes, I know it’s still AX 4), we found out that the AX client is slow in startup and it takes about 10 seconds after double-clicking the Dynamics AX icon before the application is fully loaded.

It's really simple to resolve this. Go to IE > Internet Options > Advanced tab > Security node > verify that the "Check for publisher's certificate revocation" checkbox is unchecked.
Once this is done, AX client is loaded almost instantly after double-clicking the icon.

Create Alert using X++ codes

Sometimes Infolog message is not sufficient enough for prompting information to users. It is possible to create alert message using code as an alternative. It is fairly simple to create alert message manually by just inserting a new record in EventTable where all the alert messages are stored. Below is a code snippet for creating alert using code in AX 2009.
static void CreateAlertUsingCode(Args _args)
{
    EventInbox          inbox;
    ;

    inbox.initValue();
    inbox.ShowPopup     = NoYes::Yes;
    inbox.Subject       = "This is the Alert subject";
    inbox.Message       = "This is the Alert message";
    inbox.AlertedFor    = "This alert is just information no links are available";
    inbox.SendEmail     = false;
    inbox.UserId        = curuserid();
    inbox.TypeId        = classnum(EventType);

    inbox.AlertTableId  = tablenum(Address);
    inbox.AlertFieldId  = fieldnum(Address, Name);
    inbox.TypeTrigger   = EventTypeTrigger::FieldChanged;
    inbox.CompanyId     = curext();
    inbox.InboxId       = EventInbox::nextEventId();;
    inbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
    inbox.insert();
}