Can I Roll Back a Script Diagram Element That Involves Data Operations in Flows If Other Diagram Elements Fail to Be Operated?
If a script involves operations such as adding, deleting, and modifying data, a rollback is performed by default for the diagram element after other script diagram elements failed. If an independent transaction is written in the script, the rollback is not performed.

The following shows the format of an independent transaction. If the script includes the bolded content, the independent transaction is enabled. Even if the flow referencing this transaction fails, the transaction operation will not be rolled back.
import * as db from 'db'; @userObject(['student__cst']) class Demo{ test():void{ let student = db.object('student__cst'); //Perform some database operations. let op =function(): viod{ //Perform other database operations. }; //The database operations in op are independent transactions and do not affect the transaction operations outside op. db.transaction(op) } }
Use db.transaction to perform a series of operations in a transaction, either all successful or all failed. The success or failure of db.transaction is independent of external operations, and vice versa.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot