55
Views
6
Comments
Solved
Does an end node always commit a transaction
Question

Hello community.

I have seen previous mentions like 

https://success.outsystems.com/documentation/11/reference/outsystems_language/data/database_reference/handling_transactions/ and https://www.outsystems.com/forums/discussion/38493/commit-transaction-action-when-is-it-needed-why/ 

stating the end node implicitly commits transactions.


My question is this: if I have a request that spans multiple server actions and more than one of these actions writes to the database when is the transaction committed?

ie is the transaction commit at the end node of the first action that writes data? 

and then there is another transaction for the second write?

or can I rollback multiple writes in multiple actions with one exception rollback?


thank you,

Andy

2025-05-02 20-28-47
Drishti Menghani
Solution

Hi @Andy Cody 

Hope you are well,

"The commit happen when the top most end node reaches."

By default there are exception handlers if you don't define any, in which there is abort transaction which roll back everything.



For your use case.

Request

action 1 calls

    action2 write1 end2

    action3 write 2 end3 (IF ERROR)

end1 - (CATCHES EXCEPTION - ROLL BACK EVERYTHING)

end request

If your action3 had any exception handler and set to abort transaction, it will abort complete transaction happen so far, which includes actions2 as well.


Let's go in bit details.

Request

action 1 calls - fine

    action2 write1 end2 - fine

    action3 write 2 (IF ERROR)

            Raise Exception

            If action 3 Has Exception handler

                     Abort the transaction

             END (it's end for entire transaction)

             If action 3 Not has exception handler

             Move the exception to action1

If action 1 Has exception handler

       Abort the transaction

END (it's end for entire transaction)

 If action 1 Not has exception handler

             Move the exception to Global Handler (It abort the transaction)

                     Abort the transaction

             END (it's end for entire transaction)

end1

end request


Once Exception occur it follows the path of handler and ends there, rolling back everything so far.


Hope this will help you!

UserImage.jpg
Andy Cody

wow @Drishti Menghani what a great answer. thanks very much.

Lovely reminder of how smart and helpful the community can be.


2025-05-02 20-28-47
Drishti Menghani

Mention not!! always there to help. : )

2026-01-28 16-57-48
Mihai Melencu
Champion

Hi Andy,

By default in OutSystems, the End node automatically commits any open transaction when it’s reached. That means if you execute several Server Actions that write to the database, and you never call CommitTransaction explicitly, the platform will commit all those changes once flow reaches the End node.

If you need control and want each Server Action’s database changes to be committed immediately after it runs, you can insert a CommitTransaction action after each Server Action.

If you never invoke CommitTransaction explicitly and one of your Server Actions throws an uncaught exception, the entire transaction is rolled back automatically. In that case, all database changes made within that transaction are reverted.


UserImage.jpg
Andy Cody

thanks @Rupesh Patil  &  @Mihai Melencu for your replies.


Sorry Mihai, to clarify when you say 

"the platform will commit all those changes once flow reaches the End node" 

is that the final end node of the final server action of the entire request or 

is it the immediate end node of the action the database write is in?


eg


Request

action 1 calls

    action2 write1 end2

    action3 write 2 end3

end1

end request


if I hit an error in action3 and rollback, 

is write1 rolled back or has it been committed at end2


thanks again

Andy.

2025-05-02 20-28-47
Drishti Menghani
Solution

Hi @Andy Cody 

Hope you are well,

"The commit happen when the top most end node reaches."

By default there are exception handlers if you don't define any, in which there is abort transaction which roll back everything.



For your use case.

Request

action 1 calls

    action2 write1 end2

    action3 write 2 end3 (IF ERROR)

end1 - (CATCHES EXCEPTION - ROLL BACK EVERYTHING)

end request

If your action3 had any exception handler and set to abort transaction, it will abort complete transaction happen so far, which includes actions2 as well.


Let's go in bit details.

Request

action 1 calls - fine

    action2 write1 end2 - fine

    action3 write 2 (IF ERROR)

            Raise Exception

            If action 3 Has Exception handler

                     Abort the transaction

             END (it's end for entire transaction)

             If action 3 Not has exception handler

             Move the exception to action1

If action 1 Has exception handler

       Abort the transaction

END (it's end for entire transaction)

 If action 1 Not has exception handler

             Move the exception to Global Handler (It abort the transaction)

                     Abort the transaction

             END (it's end for entire transaction)

end1

end request


Once Exception occur it follows the path of handler and ends there, rolling back everything so far.


Hope this will help you!

UserImage.jpg
Andy Cody

wow @Drishti Menghani what a great answer. thanks very much.

Lovely reminder of how smart and helpful the community can be.


2025-05-02 20-28-47
Drishti Menghani

Mention not!! always there to help. : )

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.