Revert Transaction

Returns all records changed in the transaction to their original state and ends the current transaction.

Options 

  • Condition reverts a transaction only if evaluated as true.

  • Error Code returns a custom error code for Get(LastError), Get(LastErrorDetail), and Get(LastErrorLocation) if the provided code is in the range of 5000 through 5499.

  • Error Message returns a custom error message for Get(LastErrorDetail) and Get(LastErrorLocation) if an error code is provided and the provided code is in the range of 5000 through 5499.

Compatibility 

Product

Supported

FileMaker Pro

Yes

FileMaker Go

Yes

FileMaker WebDirect

Yes

FileMaker Server

Yes

FileMaker Cloud

Yes

FileMaker Data API

Yes

Custom Web Publishing

Yes

Originated in version 

19.6.1

Description 

Revert Transaction:

  • Exits the active record

  • Will activate appropriate triggers

  • Is only allowed between Open Transaction and Commit Transaction, unless it's used in a nested transaction (see Open Transaction). Otherwise, it returns error 3 ("Command is unavailable").

Revert Transaction will:

  • Jump to the matching Commit Transaction step

Revert Transaction will not:

  • Revert Auto Enter Serial Number Increment

  • Revert Truncate Table

  • Activate the OnRecordRevert script trigger

Example 1 

Reverts the records in a transaction.

Copy
Open Transaction []
    Set Field [ Assets::Description ; "descriptive text" ]
    Revert Transaction []
Commit Transaction

Example 2 

Reverts the records in a transaction if the condition is met.

Copy
Open Transaction []
    Set Field [ Assets::Description ; "description text" ]
    Revert Transaction [ Condition: 1 ]
Commit Transaction

Example 3 

Reverts the records in a transaction and returns a custom error.

Copy
Open Transaction []
    Set Field [ Assets::Description ; "descriptive text" ]
    Revert Transaction [ Error Code: 5001 ; Error Message: "custom error text" ]
Commit Transaction