for some reason, no documentation of UIPath mention, how to use this very basic functionality (database transactions).
from my experimence short experience with the platform, this seems to be a common problem with UIPath
By trial and error I eventually figgured out, how are you supposed commit or rollback inside Start Transaction Activity container (UiPath.Database.Activities.DatabaseTransaction):
It only rollbacks if exception is thrown from withing the activity container.
But from SQL transaction you probably want to rollback when something in SQL code went wrong, not in studio. So you have to add your own “rollback” exception and either:
- and check continue on error in the DatabaseTransaction activity (you cannot catch any studio-thrown exception this way!)
- or wrap your SQL code not only into DatabaseTransaction container, but also into try-catch container where you ignore selfthrown “rollback exceptions” but deal with real exceptions with for example Rethrow.
I am aware that author probably already found his solution/workaround. I haven’t found any useful info on this subject on forum nor anywhere else. Hopefully this might help someone in the future.