web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to create table method with X++ coding in AX 2012

(0) ShareShare
ReportReport
Posted on by 95

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)
  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at

    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();
    }
    

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans