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 :
Microsoft Dynamics AX (Archived)

OnInserted event

(0) ShareShare
ReportReport
Posted on by 4,131

Hi,

I would like to modify the inserted method. The scenario is when the DirPerson record is created, I would like to add to another record based on the current DirPerson information. How can I achieve this? It seems not able to modify the Directory model, and when I create an extension, I can only use the onInserted event handler? But I am not sure how to get the current DirPerson table buffer in the onInserted event handler.

Thanks in advance,

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Basheer17 Profile Picture
    2,720 on at

    [DataEventHandler(tableStr(DirPerson), DataEventType::Inserted)]

    public static void DirPerson_onInserted(Common sender, DataEventArgs e)

    {

          DirPerson dirPerson = sender as DirPerson;

    }

    sender is the current record/buffer.

  • Yuji Profile Picture
    4,131 on at

    Thanks a lot.

  • Yuji Profile Picture
    4,131 on at

    BTW, do I just create a new class and copy this dataeventHandler method to the new class as a method? And this is it, or do I need to do some more modifications on the class.

    Thanks

  • Basheer17 Profile Picture
    2,720 on at

    Yes, you can copy the event handler method in a new class. You don't have to do more modifications. If you want to add new methods to the table then you must create new class and add ExtensionOf attribute. I always keep two separate classes one for extension and one for event handlers. If you wish to keep a single class, that would also be fine.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans