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.
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
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?
Ranjith
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.
Hi Ranjith,
the answer will be B,
it rollback your city creation transaction and only create the audit record.
Thanks.
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).
Sujay
Thank you @sujay kamath