如何在AX2012中获取表单的访问路径?

时间:2014-02-18 09:00:00

标签: axapta x++ dynamics-ax-2012

我必须获取表单的访问路径,如工作区的地址栏中所示,或者像使用x ++的表单的帮助文件中所示。

提前谢谢

1 个答案:

答案 0 :(得分:2)

我不确定你是否可以在面包屑中获取当前路径,我不知道如何。但您可以使用crossref查找使用菜单项的所有实例。它要求交叉引用是最新的,但这应该不是问题,因为您只需要运行一次。

以下作业构建了可以打开客户列表页面的路径:     static void JobXrefBC(Args _args)     {         #TreeNodeSysNodeType         #Properties         #AOT         TreeNode menuItemNode = TreeNode :: findNode(@“\ Menu Items \ Display \ CustTableListPage”);         TreeNode menuNode;         xRefPaths xRefPaths;         xRefReferences xRefReferences;         TreeNode parentNode;         Str路径;

    if(menuItemNode)
    {
        xRefPaths = xRefPaths::find(menuItemNode.treeNodePath());

        while select xRefReferences
            where xRefReferences.referencePathRecId == xRefPaths.RecId
            && xRefReferences.Reference == XRefReference::Read
        {
            path = SysLabel::labelId2String(menuItemNode.AOTgetProperty(#PropertyLabel));

            menuNode = TreeNode::findNode(xRefPaths::findRecId(xRefReferences.xRefPathRecId).Path);

            if(menuNode && SysTreeNode::path2ApplObjectType(menuNode.treeNodePath()) == UtilElementType::Menu)
            {
                parentNode = menuNode.AOTparent();

                while(parentNode && parentNode.treeNodePath() != #MenusPath)
                {
                    path = SysLabel::labelId2String(parentNode.AOTgetProperty(#PropertyLabel))  + " > " + path;
                    parentNode = parentNode.AOTparent();
                }

                info(path);
            }
        }
    }
}

输出结果为:

Accounts receivable > Common > Customers > All customers
Sales and marketing > Common > Customers > All customers