RE: Loop through grid fields in Ax 2012 in RUNTIME
You can use isVisible
Set all fields's autoDecleration to Yes and check with control.isVisible
As a alternative I wrote a code with treeNode but it seems treeNode can't get usage Data from user. I didn't want spent to much time, probably I didn't catch some point. Here the code, maybe it can be helpfull
static void dmr_ES_GetFormFieldsInfoWithTreeNode(Args _args)
{
TreeNode treeNode = TreeNode::findNode(@'\Forms\DmrESTestFormVisible\Designs\Design\[Grid:Grid]');
treeNode treeNodeChild;
TreeNodeType treeNodeType;// = treeNode.treeNodeType();
FormControl FormControl;
FormTreeControl FormTreeControl;
void nodeInfo(treeNode _treeNode)
{
if(treeNodeChild.treeNodeName() != "Methods")
{
treeNodeType = _treeNode.treeNodeType();
//info(strFmt("Id: %1", treeNodeType.id()));
info(strFmt("Name: %1", _treeNode.treeNodeName()));
info(strFmt("Name: %1", _treeNode.AOTname()));
info(strFmt("AllProperties: %1", _treeNode.AOTgetProperties()));
info(strFmt("Visible: %1", _treeNode.AOTgetProperty("Visible")));
info(strFmt("isVisible: %1", _treeNode.AOTgetProperty("Visible")));
}
}
if(treeNode)
{
if(treeNode.AOTchildNodeCount())
{
treeNodeChild = treeNode.AOTfirstChild();
nodeInfo(treeNodeChild);
while(treeNodeChild.AOTnextSibling())
{
treeNodeChild = treeNodeChild.AOTnextSibling();
nodeInfo(treeNodeChild);
}
}
}
}