The cootx variable can be used to access the current transaction context. The most important methods of a transaction are listed in chapter “Accessing the transaction context”.
In some scenarios it is necessary to carry out operations in a separate transaction. Any changes that have been made in a new transaction can be committed or rolled back separately from the main transaction.
Example |
usecase CreateInvoice() { try { Invoice @invoice = #Invoice.ObjectCreate(); @localtx.Commit(); // Clear the variables holding the transactions |
Note: A better and simpler way to create transactions is using the try new transaction statement. Please refer to chapter 14.10.5 “Creating new transactions or opening a transaction scope” for further information.
Syntax |
// Retrieving the value stored in a transaction variable // Storing a value in a transaction variable |
The #TV object is a special object that provides access to transaction variables.
Note: Transaction variables can also be accessed using the cootx variable. Please refer to chapter “Predefined variables” for further information.
Example |
// Retrieving the value stored in a transaction variable // Storing a value in a transaction variable |