Database Transaction Handling

Salesforce B2C Commerce can handle database transactions via a pipeline, either implicitly or explicitly. An implicit transaction is automatically controlled by the Pipeline Processor, while an explicit transaction is defined by a developer.

Implicit Transactions

Developers can't define whether a pipelet is transactional, because it's defined by B2C Commerce internally as either transactional or not. The exception to this is the Script and Eval nodes. If the script/eval statement must update the database, they must be configured as transactional.

When the transaction is reached during pipeline processing, a database transaction is automatically started and implicitly committed at the end of the pipelet execution (or rolled back in case of error).

To set the node to transactional, select the Transactional field in the Property view, then select true.

Explicit Transactions

You can also perform a database transaction explicitly within a pipeline. You usually create explicit transactions if you want multiple pipelets to succeed or fail together. For example, if you want to rollback several execution steps in the pipeline, if the final step doesn't succeed.

You can:

Use this method when the specifics of a database transaction need to be more controlled within a pipeline.