75
Views
6
Comments
Solved
Handling Transactions
Question

Consider the Action represented in the picture, when called at runtime, there is an Exception raised in the highlighted CreateAddress Action call. What is the expected behavior of the Action after the Exception is raised?

A) There is only new City and Audit records added to the database.

B) There is only a new Audit record added to the database.

C) There are no new records added to the database.

D) There are new City, Address and Audit records added to the database.



Screenshot 2023-12-18 112610.png
Screenshot 2023-12-18 112452.png
2020-09-21 11-35-56
Sachin Waghmare
Solution

Hello @Ranjit,

It will rollback your whole main transaction. It will create a record into Audit table only when database exception occurs. Please refer this documentation for more information about transaction and exception handlers.

https://success.outsystems.com/documentation/11/reference/outsystems_language/logic/implementing_logic/logic_tools/exception_handler/?

https://success.outsystems.com/documentation/11/reference/outsystems_language/data/database_reference/handling_transactions/?

Thanks,

Sachin

 

UserImage.jpg
Ranjith Ravi

Hi @Sachin Waghmare,

Now I can understand about Handling Transaction, Now in the same above scenario, what will happen if Abort transaction is set to "No" in handler property?

Thanks,

Ranjith

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Ranjith Ravi ,

when you are learning a new technology, a "what will happen if ..." question is an excellent candidate for trying out yourself, i.m.o. this is one of the best ways of learning and discovering.

2023-11-22 10-51-50
Jozy Sohail

Hi Ranjith,

the answer will be B,

it rollback your city creation transaction and only create the audit record.

Thanks.

2023-10-18 08-33-42
sujay kamath

Hi Ranjith,

I just tried out above scenario with db exception in highlighted action, below are the results,

If Abort transaction is No then City and Audit data is created (option A) .

If Abort transaction is Yes then only Audit data is created (option B).

Thanks,

Sujay

UserImage.jpg
Ranjith Ravi

Thank you @sujay kamath 

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