Script Triggers in FileMaker 13

Script Triggers Drawn Out (Updated for FileMaker 13)

A while back I wrote a blog post on how FileMaker 12 script triggers function.

Here’s an update for FileMaker 13:
(Most of the writeup is the same, because, well, it still applies 🙂

There are quite a few nuances in how FileMaker script triggers function. Two of the more straightforward ones are the sequence that script triggers evaluate in (e.g. OnObjectKeystroke fires before OnLayoutKeystroke) and the timing of a script as compared to the event that triggered it (i.e. pre- vs post-event triggering).

For me, the difficulty with these two attributes isn’t comprehension; it’s memorization. I find myself looking this stuff up over and over again. So, to make it easier to remember, I mocked up the following diagram. Hopefully it has some use for you as well.


Note, the graphic above was corrected on 4/25/15:

  • OnWindowOpen was green (pre), now it’s red (post)
  • OnWindowClose was red (post), now it’s green (pre)
  • OnGestureTap was shown after OnLayoutSizeChange, now it’s after OnLayoutKeystroke
  • OnPanelSwitch was shown after OnObjectExit, now it’s after OnGestureTap

Breaking this graphic down a bit…

There is a method to the order in which triggers fire:

  1. First, you have the entering into the interface elements, which happens in the following order: file, window, layout, mode, view, record, object.
  2. Next you have the interacting with the objects that have been laid out; e.g. a user types something, a script makes a field active, etc. Each of these script triggers deals with objects (except for OnLayoutSizeChange, OnGestureTap and OnLayoutKeystroke).
  3. You complete ehe “transaction” with the leaving of the interface elements, which happens in reverse order: object, record, view, mode, layout, window, file.

I’ve marked the post-event actions in red to connote a sort of warning as FileMaker does not allow us to cancel these triggering events.

A comment on the differences between FileMaker 12 and 13:

FileMaker 13 introduced two brand new triggers and a change to one of the existing triggers:

  • OnLayoutSizeChange – mostly targeted towards iOS, but also fires when a window is resized in Pro, including as a result of showing or hiding the status toolbar
  • OnGestureTap – iOS only; remember that it also fires even when you tap a button or tap to enter into a field
  • OnPanelSwitch – replaces OnTabSwitch to account for the new slide control (slide panels are akin to tab panels with respect to the OnPanelSwitch trigger); also note the change in firing order (OnTabSwitch used to be after OnLayoutKeystroke)

Wim Decorte’s Script Triggers PDF Reference and Test File

Update May 2015:

  • Learn more about script triggers for FileMaker 14
  • Download the Script Triggers Cheat Sheet and demo files

(The FileMaker 12 version of these two files appeared in Kevin Frank’s post back in July 2012.)

On the face of it, script triggers are fairly straightforward. But there are nuances and non-obvious considerations to each one. Wim’s color-coded PDF reference provides notes that highlight these subtle variations.

For instance, did you know that the OnLayoutSizeChange trigger won’t run in Preview mode? Here’s another exampe: if you drag & drop data into an inactive field, the OnObjectModify trigger will not fire for that field even though its content will have been modified.

Trigger table for FileMaker 13

The test file demonstrates the firing order and behavior for each trigger. Open it in Pro, Go, and in your web browser (via WebDirect) to learn how triggers behave in different clients. The layout contains every conceivable type of object, so that no stone is left unturned.

Since all possible events are configured, the tool is great to see the exact sequence of events on any number of actions such as moving between fields, moving between records, switching between tabs or panels, opening up a pop-up, etc.

trigger test file for FileMaker 13

12 thoughts on “Script Triggers in FileMaker 13”

  1. Thanks – this is a very helpful article. One additional area where I find the FM Help documentation is particularly obtuse is in relation to events. No doubt future versions of FM will add triggers specific to events (I remember this in my days at Oracle back i the 90s!) but otherwise the behaviour eg around executing Find and OnModeExit trigger in Find mode is not intuitive.

    I’ve just sent the following feedback to FM in relation to their Help documentation:

    OnModeExit “Triggers a script to run before a user tries to exit the current mode on a layout.”

    This does not make the behaviour of this trigger clear when used in Find Mode. In testing I’ve found that the trigger executes the script AFTER the find has been executed (even though in stepping through with debugger the Find Requests are still displayed until the script exits).

    The documentation implies that the trigger should execute before the Perform Find (which is what I was hoping for). I have tested this by clearing the Find criteria in the OnModeExit script triggered in Find Mode and the resulting Found Set matches the (cleared) criteria.

  2. Pingback: FileMaker13のスクリプトトリガ | Not Only FileMaker

  3. Pingback: Virtual FileMaker Script Triggers

  4. Pingback: FileMaker Drag and Drop: A Feature that Subverts the Record's Life Cycle

Leave a Comment

Your email address will not be published. Required fields are marked *

Are You Using FileMaker to Its Full Potential?

Claris FileMaker 2023 logo
Scroll to Top