Loading ...

Purpose Of RowPersisting Event

Hello everybody,

today I want to leave a note on usage of RowPersisting event.

Quite often I see situations, when RowPersisting is used for making additional insertions to database. Also quite often I see cases when some additional inserts being performed to database. 

I want to warn against such an approach. Reason for that is that during RowPersisting event, Acumatica opens transaction scope. Because of that, additional readings from db, or additional persists to db in scope of RowPersisting may lead to performance degradation and even deadlocks. 

Purpose of RowPersisting event is kind of latest resort, in which you can modify your record before putting it to database. And it shouldn't be used for some other purposes. Other purposes of RowPersisting event is validate record before it was putted to database, or cancel commit operation through throwing of an exception.

If you're working on Acumatica customizations and want to ensure optimal performance without risking deadlocks, it's crucial to handle RowPersisting events correctly. Need expert guidance or a tailored solution for your project? Leave a request for a customization today, and let’s build a seamless and efficient Acumatica experience together!