Update 2 Aug 2025: the issue documented in this article has been resolved in FM 22 (a.k.a. FM 2025).
This article documents behavior in the current shipping version of the product, i.e., FM 21 (a.k.a. FM 2024).

Demo file: transaction_test.zip (requires FM 21 or later)
This is a follow-up to last month’s article on Modal Transactional Card Windows to address a very specific question. Given that transactions are scoped to a window, does a transaction properly revert when you close the window where the transaction was initiated?
At first glance it would appear that the answer is yes, but appearances can be deceiving, and today we have a demo file from Jonathan Jeffrey that can help us understand what is actually going on, and which I am sharing with his kind permission.
Basic Structure of the Demo
There are two tables…

…and here’s how they appear on the graph.

Records_1 is a dashboard, and when the “Transaction Test [ revertOption ]” script runs (see below) records will be created in Records_2, and will appear in this portal.

In addition to the above, there is a table view layout based on Records_2, and all records will be created from the context of this layout.

About The Script
From the main layout, all three buttons call the same script, “Transaction Test [ revertOption ]”, optionally passing a parameter, and here’s an overview of what the script does. The script…
- Clears out entries in Records_2 via Truncate Table.
- Opens a new document window on the Records_2 layout
- Opens a transaction
- Creates a new record
- Opens a second document window on the Records_2 layout (and since transactions are scoped to a particular window, any activity in this window will occur outside the transaction)
- Creates a new record
- Closes the second document window
- Returns the focus to the document window that was created in step 2
- Repeats steps 4 – 8 two more times (so a total of six records are generated — three “inside” the transaction and three “outside” the transaction)
- Optionally reverts, and if so, either “implicitly” (via Close Window) or “explicitly” (via Revert Transaction)
- Commits the transaction — but of course this step will be ignored if the transaction was reverted in the previous step
- Closes the document window that was created in step 2 (if it was not already closed in step 10).
Now we have reached the halfway point of the script, and either three or six records have been created, depending on which button was clicked.
The second half of the script is pretty much a repeat of steps 1-12 above. Six more records will be generated… as before, three from “inside” the transaction and three more from “outside” the transaction. The main difference is that this time the optional revert at step 10 will execute “explicitly” in either case.
Running The Demo
When you click the first button…

…you will end up with the expected result: 12 records — the six (3 x 2) created within the two transactions, and the six (3 x 2) that were created outside the two transactions.

When you click the second button…

…you will also end up with the expected result: 6 records — the ones created outside the two transactions (the other six, the ones generated from inside the transactions, evaporated when the transactions were reverted).

But something interesting happens when you click the third button.

You do not end up with the expected result.

To see where things start to go sideways, open the Debugger, click the “Close before commit” button, set a break point at step 53 and run to the break point.

At this point you will be on the Records_2 layout in the transaction window, and will see six records.

Now step once so you close the window, and it will appear that the transaction has reverted…

…except… step once more and a dialog appears indicating that the transaction is still open.

You can confirm this via the Data Viewer.

Now continue stepping and you will see various errors, e.g. the Commit Transaction at step 65 fails, the Open Transaction at step 88 fails, etc.
Closing Thoughts
The Claris Help page for Open Transaction lists a number of actions that will cause a transaction to revert and Close Window is not one of them.

As of today (May 18, 2025), there is no mention of “Close Window” anywhere in the Open Transaction help entry — a search returns zero results. Given that transactions are scoped to the window they originate in, this seems an odd omission.
Be that as it may, common sense would suggest that when you want to revert a transaction within your script, the safest course of action is to do so via Revert Transaction or Halt Script.
