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

Announcements

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
dserp Profile Picture

dserp 4

#2
dekion Profile Picture

dekion 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans