Transaction scope and processing
In a workflow, most task steps are processed in their own scope. If there are no problems affecting successful processing, a task step performs its database operations and the workflow's processing moves to the next task step and that task step processes as a unit. This continues through the entire workflow and provides data integrity within the task step, but it does not allow transactions that span task steps. Note that for Iterator and Loop tasks there are no transactions that span any or all of the iterations of the tasks within a given Iterator or Loop. Also, for tasks such as Associate Records or a task that works on a set of records and causes changes, where there may be more than one record modified by a single task step, each record that is modified is processed individually within its own transaction.
The DataConnect, Create Record, and Modify Records tasks can be configured to use transactions during the processing of the task. The DataConnect task includes a Transaction parameter that is used to enable transactions. Within a DataConnect task, the Transaction parameter determines how the business object record is committed. The Transaction parameter values are part of the description of the DataConnect workflow task in DataConnect task.
When nested DataConnect tasks exist, the outermost task is in control of the transaction for that task and all nested tasks, regardless of how the nested tasks are configured. That outermost task is known as the Controlling Block. Transaction setting is valid only on the outermost DataConnect task with a Transaction setting (All Iterations, Per X Iterations). If the Transaction parameter is set to None, the DataConnect task processes the same as other workflow tasks.
The Create Record and Modify Records workflow tasks, like the DataConnect task, have Transaction properties available that can be used to enable transactions. Within a Create Record task or Modify Records task, the Transaction parameter determines how the business object record is created. The Transaction parameter values are part of the description of the Create Record task in Create record task and of the Modify Records task in Modify records task.
When the Transaction parameter is set to None, the DataConnect, Create Record, or Modify Records task processes the same as other workflow tasks. It is only when the Transaction parameter has another value that a transaction is used across multiple tasks (DataConnect) or multiple records (Create Record and Modify Records).
A transaction is committed if everything processes correctly within the controlling block and is rolled back if an error that would compromise data integrity is encountered.
There are two ways a transaction can be committed:
- The controlling block is exited successfully.
- A looping type controlling block successfully reaches the end of an iteration that meets the transaction criteria (number of iterations) configured for the transaction block.
A block is successfully exited if it:
- Meets the exit criteria without encountering a fatal error or a processing condition (task) that rolls back the transaction.
- Encounters an End task within the block before encountering a condition causes a rollback.
- Breaks out of a controlling block with a state of Success.
A transaction is rolled back if the controlling block does not complete successfully. The following cause unsuccessful completion of a block:
- Encountering a non-recoverable error within the block (this includes non-recoverable errors anywhere within the block or anywhere within nested blocks).
- Encountering a Stop task within the block (this includes Stop tasks within nested blocks).
- Breaking out of, or Continuing, a controlling block with state of Error.