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.
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.
Then it is definitely executed inside of the transaction.
Hi,
I tried it.
Both oninserted and post handler rolls back the insert in case on any error in event handler.
Thanks.
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.
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.
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.
André Arnaud de Cal... 291,391 Super User 2024 Season 2
Martin Dráb 230,445 Most Valuable Professional
nmaenpaa 101,156