Caching form into AOS to increase performance for Dynamics AX

Scenario:

Normally when we open form for the first time in Dynamics AX, it will take sometimes to compilte and cache into AOS. That’s why at second time always faster. If we often restart AOS, how can we keep performance ?

Solution:

After restart AOS we can let some scripts run to open up some often used forms then cache to AOS, then close those forms.

Here is the code

static void WarmupRF(Args _args)

{
    UtilElements e;
    TreeNode treeNode;
    FormRun formRun;

    Args args = new Args();

    while select e
        where e.utilLevel  == UtilEntryLevel::var    //<-- specify layer here
        &&    e.recordType == UtilElementType::Form  //<-- and only forms
        &&    e.name like "nameofformPrefix"

        {
            try
            {
                treeNode = xUtilElements::getNodeInTree(xUtilElements::parentElement(e));
                args.name(treeNode.AOTname());
                formRun = ClassFactory.formRunClass(args);
                formRun.init();
                //formRun.run();   //<-- No need to run the form, but sometimes it can load the data
                formRun.close();
            }
            catch
            {
                Infolog.clear();
                continue;
            }
        }
}

Max Nguyen

Max Nguyen
MCP - Microsoft Dynamics AX Technical Consultant, currently living and working in Seoul, S.Korea :)

Number sequence farmework overview in Dynamics AX 2012

How to create number sequence in Dynamics AX 2012 with difference scenarios Continue reading

Overview delete action in Dyanmics AX 2012

Published on January 19, 2017

Response in AIF custom service class

Published on January 12, 2017