I have a WebDirect based ticketing system open to the public. One concern of this system was to reduce the number of empty tickets, which could be caused by bots, or by real people who click into the site and then exit.
I had a pretty good system working using the OnRecordCommit
layout script trigger and a script which would read a global variable set to 0 or 1, so that record commits could be fully scripted and controlled.
If a user exited the system, I scripted a Revert Record
step before saving, and no new record was created.
It worked fine.
But something or someone (probably me) broke it, and I started getting a bunch of empty / blank records.
Digging into this, I think the problem was that I added some new features (including debug logging) and something about this forced a record commit before I was on the proper layout.
I've fixed it now, but this brought up a question:
What specific events trigger a record commit?
There are many we know about:
- clicking outside a field
- navigating to a different record
But other events are less clear - do these trigger Commit events? In WebDirect? Always? or only sometimes?
- Go To Layout
- New window
- New window with a different layout (even if the new window is opened in Card mode)?
- GTRR
- switching to browse or preview mode? (what if you are already in that mode?)
- a commit records step in a different window?
- etc...
I believe in my case, the inadvertent record commit was due to a Logging script I wrote, which did a bunch of things:
- created a New Window
- Entered Browse Mode
- Go to Layout
- New Record
- Set fields
- Commit Records
- Close Window
Something about this triggered the record commit in the prior window, and I was never quite sure which step did it.