viernes, 26 de junio de 2015

Find Menu Items that call Jobs

During an upgrade from AX 2009 SP1 to AX 2012 R3 it is reasonable to assume that the AOT\Job node can be disregarded from the upgrade process.  That is until you find various menu items that point (ObjectType property) to those Jobs that have not been converted!
Menu Items are 99% of the time for launching Forms, Classes or Reports.
The first task is to find those menu items, and then to analyse if it's necessary to convert them.  Are they still relevant?  Finally, shoot the developer that is creating all of these Jobs were they should be creating classes for a more accessible and repeatable solution.

Below is a job...  To look for a Job ObjectType in the MenuItem node of the AOT.

static void Job_MenuItem_Jobs(Args _args)
{
    // Use X++ to Loop through the AOT for Menu Items that call....  Jobs!
    // http://blogs.msdn.com/b/dsiebold/archive/2010/08/13/use-x-to-loop-through-the-aot.aspx
    // http://dynamicsuser.net/forums/p/29232/154476.aspx#154476
    MenuItem    mi;

    void searchSubNodes (TreeNode _treeNode)
    {
        if (!_treeNode)
            return;

        _treeNode = _treeNode.AOTfirstChild();
        while (_treeNode)
        {
            if (_treeNode.AOTfirstChild())
            {
                searchSubNodes(_treeNode);
            }

            if (_treeNode.applObjectType())
            {
                mi = _treeNode;
                if (mi.AOTgetProperty("ObjectType") == "Job")
                {
                    info(strfmt("%1", _treeNode.treeNodePath()));
                }
            }
            _treeNode = _treeNode.AOTnextSibling();
        }
    }
    ;

    searchSubNodes (TreeNode::findNode(@"\Menu Items"));

    info("End");
}

This migration is going to be a long one.

No hay comentarios:

Publicar un comentario