Reputation: 29
I have to get access path of form like shown in the address bar of workspace , or like shown in the help file of form using x++.
thank's in advance
Upvotes: 1
Views: 2443
Reputation: 1151
I'm not sure if you can get the current path in the breadcrumb, I don't know of a way. But you could lookup all instances where your menu item is used using the crossref. It requires the cross reference to be up to date but that shouldn't be a problem because you will only have to run this once.
The following job constructs the paths by which the customer listpage can be opened: 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 path;
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);
}
}
}
}
The output is:
Accounts receivable > Common > Customers > All customers
Sales and marketing > Common > Customers > All customers
Upvotes: 2