A READER ASKS
I'm trying to design a system that would automatically record the user name, time of opening, and time of closing for a record. Ideally, it would work without the user needing to activate the function/script. I've tried to use script triggers for entry into an object/field with no luck. Any suggestions? Thanks.
You should be able to do it with script triggers. If you are tying to make it work with a production database, take a step back. Go under the file menu and create a simple prototype file. Then experiment with this. I would also write down exactly what you mean by opening a record because it could have a great many different interpretations.
One thing to remember is that script triggers are tied to the user interface. This can present both challenges and unique opportunities. You mentioned trying layout object triggers but what about the layout or record level script triggers?
OnRecordLoad, OnRecordCommit, OnRecordRevert, OnLayoutKeystroke, OnLayoutLoad, OnModeEnter and OnModeExit
I would think these trigger types might be better suited to your needs, particularly when the users are in form view. These trigger types can work almost like sub-scripts. That is to say the trigger script can fire after a regular script has finished executing. This is something to consider in your strategy. I tend to shy away from layout/record level triggers in list or table views. For some reason, I tend to think of records in these views as not truly loaded but that is obviously not the case. It is just a UI impression that I have stuck in my noggin. That is why I am suggesting you take a look at this design aspect as well. Here are some things I tent to think about in my trigger implementations ...
Views - Form / List / Table
Modes - Browse / Find / Preview
Pre Event / Post Event Triggers
Once again, I’d recommend doing your script trigger experiments with an off line prototype database and not a copy of your production database. If an experiment doesn’t work out, you can quickly trash the entire file. If it does, you can add the code to your production database and test.
More info about the author and FileMaker in general, contact me at email@example.com.
© 2009 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.
Help support this blog by considering a donating to its ongoing growth. For more details, please visit /donate.html