
Hi,
I want to create table method with X++ coding. Is it possible? If so, how can I?
In the clear, I want to add new code line table insert method.(Override) But, I need to this with X++ code.
Thanks in advance for your help.
*This post is locked for comments
I have the same question (0)ClassBuild is an excellent tool for creating and extending the class framework, however, I am unsure if you could do this with tables. Take a look at it's source code to see if there is something which you could utilize it better. See the marked answer in this post:
[View:https://community.dynamics.com/ax/f/33/t/154646:750:50]
And for creating the table method directly, you could do something like this:
public void createmethod()
{
TreeNode tableNode = new DictTable(tableNum(SalesTable)).treeNode();
TreeNode newMethodNode;
newMethodNode = tableNode.AOTfindChild('Methods').AOTadd('myTestMethod');
newMethodNode.AOTsetSource('public static void myTestMethod() { ; }', true);
newMethodNode.AOTcompile();
newMethodNode.AOTsave();
tableNode.AOTsave();
}