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

Announcements

No record found.

News and Announcements icon
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,166 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,166 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,363 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 658

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 468 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans