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

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Table OnInserted event
Finance forum

Table OnInserted event

(0) ShareShare
ReportReport
Posted on by

Hi,

In table extension class, we have onInserted event.

If we write code in oninserted event and our logic throws any exception, will the record insert be rolled back.

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Table OnInserted event

    You should be able to test it very easily. Please share the results with us. Thanks!

    At least with Chain of Command you can wrap your code and the "next" call in one transaction, in which case any exception inside that transaction will cause everything to roll back.

  • Verified answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at
    RE: Table OnInserted event

    You should not put event handler in  extension  class. Here is good explanation for that. Also in your scenario , record is not going to be inserted in your table if its in transaction, you can try it yourself for any simple table.

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at
    RE: Table OnInserted event

    onInserted  happens after record is inserted. There are 2 possible scenarios here:

    1) insert is inside transaction. Any exception in the transaction will terminate it and roll back.

    2) insert is not in the transaction scope. Data would be committed to DB before calling your eventHandler.

  • Community Member Profile Picture
    on at
    RE: Table OnInserted event

    Hi,

    I tried it.

    Both oninserted and post handler rolls back the insert in case on any error in event handler.

    Thanks.

  • Verified answer
    Mea_ Profile Picture
    60,284 on at
    RE: Table OnInserted event

    Then it is definitely executed inside of the transaction. 

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans