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.
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.
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.
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.
I tried it.
Both oninserted and post handler rolls back the insert in case on any error in event handler.
Thanks.
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.
Congratulations to a top community star!
In our never-ending quest to help the Dynamics 365 Community members get answers faster …
Welcome to the next edition of the Community Platform Update. This is a status …
Stay up to date on forum activity by subscribing.