Skip to main content
nguyenb6532
June 6, 2023
Question

About Transaction Management

  • June 6, 2023
  • 14 replies
  • 1 view

We would like to use Smart Service to delete records from the DSE (Data Store Entity) and create records according to the input received from the screen.
In this case, will the Delete and Write transactions be separated?
For example, if Write after Delete fails for some reason, I would like the Delete transaction to rollback.

Please let me know if there is a way to execute Delete and Write in the same transaction on Smart Service.

    14 replies

    harshitb6843
    June 6, 2023

    You have to use two different services for the same. 
    For your use-case, you can create a process where you always keep a backup of what was deleted and what was inserted so you can insert the deleted ones and delete the inserted ones if the process fails. 

    nguyenb6532
    June 6, 2023

    Thank you for your reply. I'm thinking about query database, what about this?

    harshitb6843
    June 6, 2023

    Query Database smart service? Why you want to use that?

    stewart.burchell
    June 6, 2023

    Alternatively you can write a Stored Procedure that conducts both Write and Delete operations in the scope of a single transaction and then invoke that from Appian. You'd need to detect any failures/rollbacks issued from the Stored Procedure and handle this in your process model so that the appropriate notification(s) and action(s) can be conducted.

    nguyenb6532
    June 7, 2023

    Thanks for the answer. Is there any concrete example of how to use it on Appian. I didn't find much useful information on how to use it nor how to feed information from the process variable to it.

    stefanhelzle0001
    June 6, 2023

    I my experience, it is a better approach to not make the database manage a transaction, but to look at the Appian process to be that instance.

    nguyenb6532
    June 7, 2023

    Thanks for the answer. I understand what you mean but in order to fulfill the request from the client we need to create many different tables to manage the data. I'm a little nervous when doing data write or delete in tables without transaction manager.