I'm including a value list in this server action CREATE.
How do to rollback, when for example occur wrong in the inclusion seventh register ?
Because, in this case I need cancel commit until the sixth included register.
This table will receive in the max 10 register each time.
Its automatically rollback for you if there is exception happened.
Hi Vivian,
Hope you are doing well.
There is one property for the exceptional handler. If you set it to yes then it will rollback the changes automatically.Please find the below snapshot.
Thanks.
btw its never a good idea to invoke database operations in a loop. Do consider using Bulk Insert forge component.
Hi @Vivian Mattos ,
As the previous answers mentioned, the transaction that creates the first 6 products should automatically undergo a rollback process due to the default behavior of the Exception Handler where the property Abort Transaction is set to Yes.
If you are asking this question because it does not rollback the changes, then you may have set the Abort Transaction to False. You can set this back to True.
Otherwise, there might be some logic that commits the transaction explicitly inside your Product_Create. It could be that you are calling CommitTransaction inside that action or you are calling a service action/Rest inside.
Have a look and check if that might be the case.
Regards,
Bryan
In to what is already shared by others, an action either gets committed or is completely rollback on exception by default, you can find more information about handling transactions in OutSystems here:
Furthermore there are two platform server actions you can use to customize the behaviour but explicitly committing or aborting transactions in your server action:
Daniel