Microsoft Dynamics AX 2012:Find AOT Object path using TreeNode

Agenda:

“User need to find out the path of selected AOT objects”

AOT View

AOT

Now here,we have a parent node ‘AOT’ which contains all child objects,also we have a child object called ‘Data Dictionary’ which have sub childs (Tables,Map,BaseEnum…etc)

User Selection

UserSelection

User selects “Classes” and “Tables” and press Ok button

Find Path method

For Classes Object

1-Take Classes object as input string

Classes1

2-Find on the AOT path

3-Return the full path

Classes2

For Table Object

1-Takes Table Object as input string

Tables1

2-Find on AOT node

3-Find on Data Dicitonary node (If not find on AOT node)

4-Returns the path

tables2

Table3

Here is the Code:

private str findPath(str nodename)
{
TreeNode treeNode;
str path;

treeNode = TreeNode::findNode(@”\”+nodename);

if(treeNode)
{
path = treeNode.treeNodePath();
}
else
{
treeNode = TreeNode::findNode(“Data Dictionary”);
treeNode = treeNode.AOTfindChild(nodename);
if(treeNode)
{
path=treeNode.treeNodePath();
}
else
{
path= “node not found”;
}
}
return path;
}

Advertisements

One response to “Microsoft Dynamics AX 2012:Find AOT Object path using TreeNode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s