---
title: "revert storage transaction · RUAL Documentation"
description: "Undoes every document write journaled by a storage transaction, newest first, refusing documents that changed since. A RUAL storage block."
canonical: https://docs.rual.nl/block-types/storage/function_transaction_revert
language: en
---

[Cluster](https://docs.rual.nl/cluster)

[Blocks](https://docs.rual.nl/block-types)

[Interfaces](https://docs.rual.nl/interfaces)

[Blueprints](https://docs.rual.nl/blueprints)

[Blueprint Language](https://docs.rual.nl/engine)

[Tutorials](https://docs.rual.nl/tutorials)

[Home automation](https://docs.rual.nl/home-automation)

[Examples](https://docs.rual.nl/examples)

[Reference](https://docs.rual.nl/reference)

[Architecture](https://docs.rual.nl/architecture)

[Troubleshooting](https://docs.rual.nl/troubleshooting)

Other

# revert storage transaction

This block is part of the [`storage`](https://docs.rual.nl/block-types/storage) group and was last modified in core [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

Undoes every document write journaled by a storage transaction, newest first, refusing documents that changed since.

- flow `flow`

- transaction id `value` Leave empty to revert the transaction open in this flow. A bare id names a transaction this blueprint started; the qualified `bp: : ` reference from the start block names one started elsewhere.

- dry run `condition` Report what would be reverted without writing anything.

- force `condition` Skip the update_hash checks: restore the journal's state even over documents changed since. Also reverts a transaction another live run holds open.

- trigger storage events `condition` Let the undo writes fire storage_event flows (off by default).

- flow `flow`

- success `condition` True only when every op was undone.

- transaction id `value`

- report `object`

- status `value`

- reverted ops `number`

- conflicts `number` Ops that could not be undone (conflicts and failures).

- error `value`

Reverts a storage transaction by id (or the one open in this flow when none is wired): walks its journal newest-first and undoes each write : a created document is hard-deleted, an updated one gets its pre-write fields back, a removed one is restored, a restored one is removed again, a hard-deleted one is recreated under its guid. Each undo checks the document's _meta.update_hash is still what the journal recorded; a document written since by anything else is reported as a conflict and left alone, so a revert never overwrites work it did not do. success is true only when every op was undone (report.complete); otherwise error is TRANSACTION_REVERT_CONFLICT and `report.ops[]` names each op's outcome (reverted, conflict, failed, skipped) and reason (document_changed, document_missing, not_removed, no_recovery_data, already_gone, …). Works on open, committed and previously failed transactions. Ownership is the attempt token the start block put in this flow; a transaction addressed by a wired id (this blueprint's, or the qualified `bp:<blueprint>:<id>` reference) can be reverted only once its opener's lease has lapsed : otherwise TRANSACTION_IN_PROGRESS, unless force is on. `force` skips the hash checks and restores the journal's state over whatever the documents hold now. `dry_run` reports the plan and touches nothing. The undo writes do not fire storage_event flows unless trigger_storage_events is on; they always record revisions. In simulation it is always a dry run.

A typical wiring for [revert storage transaction](https://docs.rual.nl/block-types/storage/function_transaction_revert): a [function trigger](https://docs.rual.nl/block-types/globals/trigger_custom_function) starts the flow; the `flow` out pin feeds [debug](https://docs.rual.nl/block-types/state%2520ui/state_debug).

[![Studio canvas example for the revert storage transaction block: typical wiring for revert storage transaction.](https://docs.rual.nl/canvas-examples/function_transaction_revert.png)](https://docs.rual.nl/canvas-examples/function_transaction_revert.png?v=3)

## Version history

Introduced in [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

- [Back to `storage`](https://docs.rual.nl/block-types/storage): Return to the main group to view all sub-groups

- [Back to `storage`](https://docs.rual.nl/block-types/storage?group=storage): Return to the group to view all blocks within this group

Was this page helpful? [Tell us what to improve](https://docs.rual.nl/support) · RUAL Docs is an integral component of the [RUAL ecosystem](https://rual.nl)
