BeginTransaction
This function creates a Transaction object in its execution path that can be used by ExecuteSQL functions.
The transaction is automatically committed after all functions in the execution path complete.
If an SQL statement fails or returns an error, all SQL statements within the transaction are rolled back.
Properties
Section titled “Properties”Connection string
Section titled “Connection string”The connection string that specifies how to connect to the database.
Isolation level
Section titled “Isolation level”The isolation level for the transaction. Learn more
| Isolation Level | Dirty Reads | Non-Repeatable Reads | Phantom Reads |
|---|---|---|---|
| Read Uncommitted | ❌ / (Not supported) | ✅ | ✅ |
| Read Committed (Default) | ❌ | ✅ | ✅ |
| Repeatable Read | ❌ | ❌ | ✅ |
| Serializable | ❌ | ❌ | ❌ |
Example
Section titled “Example”Suppose you have a sales order with multiple line items that need to be added to the database.
Using ExecuteSQL without BeginTransaction would create a new database connection for each item written to the database. By using BeginTransaction, all items are added within the same transaction.
If an error occurs during order creation, the entire transaction is rolled back, ensuring no incomplete orders are stored in the database. Adding multiple records within the same transaction also significantly improves execution speed.
Steps:
- Add a BeginTransaction function to your Solution.
- Set up the database connection for the BeginTransaction function.
- Add your ExecuteSQL functions to your workflow.
- For each ExecuteSQL, select the Use transaction property.
- Set the Transaction property (only displayed when Use transaction property is selected) to ‘BeginTransaction.Transaction’.
