Here are some helpful hints on using multi-page database transactions:
Make sure there is at least one state-aware Web object.
For RUN set-transaction-state ("START") note:
Any changes made in the same object while the state is "START" are not in the transaction.
The Web object that turns on the transaction should be "display-only" and not do any database updates.
Continue processing requests in this agent. Remember that all requests handled by the agent (even stateless ones) are done within this transaction.
If the user has a locked agent and that agent has a multi-page transaction, then every thing done by that user will be in the transaction. Be very careful about this. The user might go back to another page or try to run another Web object. Even if these are not state aware themselves, if the agent runs them, then their changes will be within the transaction.
When the user is done, set the transaction state to either "UNDO" or "COMMIT". Also set all the Web objects to stateless. Remember that setting all the objects to stateless automatically performs an "UNDO" unless you explicitly commit the transaction ahead of time.
If you decide to set "UNDO" or "RETRY", remember that changes made within the same Web request will also be undone. That is, code such as:
RUN set-transaction-state IN web-utilities-hdl ('UNDO').
FIND LAST Customer EXCLUSIVE-LOCK.
Customer.Name = 'Sic gloria transit'.
{&OUT} 'Name is ' Customer.Name.
This code shows the new name for the customer. However, the change will be undone with the rest of the transaction.
Remember to consider the case of an agent time-out. This will also force an "UNDO" of the multi-page transaction.