Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

OnInserted event

Posted on by 4,125

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

  • Basheer17 Profile Picture
    Basheer17 2,720 on at
    RE: OnInserted event

    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.

  • Yuji Profile Picture
    Yuji 4,125 on at
    RE: OnInserted event

    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

  • Yuji Profile Picture
    Yuji 4,125 on at
    RE: OnInserted event

    Thanks a lot.

  • Verified answer
    Basheer17 Profile Picture
    Basheer17 2,720 on at
    RE: OnInserted event

    [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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans