From Dwayne Wright PMP
Certified FileMaker Developer
The OnObjectModify script trigger will fire when the object it is associated with has its value changed (with a few notable exceptions). The most common firing method will be when a user types into a field or clicks into a value list to make a new selection choice. Fields with value lists attached to them are going to be a popular place for a script trigger. For example, a “No” checkbox selection to a field could easily run a number of background actions to accommodate associated business logic.
Download The Example (click here)
So if you have a field on a layout with an OnObjectModify script trigger applied, it will fire each time the field is changed ... regardless if that change is committed. So typing each letter will fire the trigger each time, so it isn’t a very good situation for a script containing the Show Custom Dialog script step. Of course, that is exactly what I did in my example file (grin).
The OnObjectModify trigger will also fire during your standard cut, paste or clear field value commands as well as the Insert family of script steps. These script step commands are dependent upon the field be on the current layout. For this reason, many developers use the Set family of script steps such as Set Field, Set Field By Name and Set Next Serial Value. Do these “non-layout dependent” script steps fire an OnObjectModify script trigger? The answer is “No”, they will not and this is something that developers will need to factor into their triggering implementations.
Other “no fire” OnObjectModify trigger situations include field auto entry settings, calculation/summary field changes and drag/drop into fields that were not actively selected. I have to admit that I’m not familiar with FileMaker drag and drop support at the time I’m writing this up. It is something I continue to forget about as I develop in day to day tasks. I’m sure that will change sometime in the future because this feature is simply too cool to ignore for long.
The OnObjectModify trigger is what is called a Post-Event Script Trigger.
You can assign a script trigger to the repeating field and the OnObjectModify will trigger each time you modify that repetitions value.
I would like to revisit my opening sentence. The OnObjectModify script trigger will fire when the object it is associated with has its value changed. In theory, you can have the same field on the same layout multiple times and each could have a different OnObjectModify trigger applied to them. In the real world, this would probably happen with a field appears on multiple tab panels. In the same field / different trigger situation, the layout field that was modified will fire its trigger and its twin fields trigger will NOT fire.
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.