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 :
Finance | Project Operations, Human Resources, ...
Answered

Basic CRUD operations

(0) ShareShare
ReportReport
Posted on by 30

Hello,

Does anyone have sample CRUD operations written in C# that they can share? Specifically I have a requirement that I create two child Customer records after a parent customer record has been created.

Any help appreciated.

I have the same question (0)
  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Any particular reason why you want to develop in C# rather than x++? Is it because you are integrating from external system and your C# code is used in this external system? If yes, how are you integrating to D365FO? That has a big impact on how the code should look.

  • pnixon Profile Picture
    30 on at

    It can be X++, but I was under the impression that X++ will eventually become deprecated.

    If you are able to share X++ CRUD operations that is also great. I am hoping to bind my code to an event handler.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    No, x++ is definetely not going to be deprecated in the foreseeable future. The entire application is written in x++! Rewriting it in C# would be an enormous effort and not provide any business value to customers so I don't think you need to think about that when developing your customizations today.

    Check the official documentation to learn more about CRUD operations: docs.microsoft.com/.../updating-deleting-and-inserting-data

    It's for AX2012 but perfectly valid for D365FO, too.

  • Verified answer
    WillWU Profile Picture
    22,361 on at

    Hi pnixon,

    You can put your codes in the 'OnInserted' event handler of CustTable like this.

    [DataEventHandler(tableStr(CustTable), DataEventType::Inserted)]
    public static void CustTable_onInserted(Common sender, DataEventArgs e)
    {
    CustTable custTable = sender as CustTable;
    }

    And see the Blog about how to create customers by X++.

    https://community.dynamics.com/365/financeandoperations/b/365foandaxtechnicalworld/posts/create-customer-using-x-d365fo-amp-ax-2012

    Hope this helps.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans