Skip links

Script trigger

FileMaker Script

What is a script trigger in FileMaker?

Script trigger are used in FileMaker to automatically execute a script when certain user interactions occur. Script triggers can be assigned to objects, layouts and in the file options. You can define when exactly the script should be executed, for example before an event, exactly during an event or after an event.

Assign script triggers to an object

To assign a script trigger to an object such as a field, first switch to layout mode in the corresponding layout in your FileMaker database. Now right-click on the desired object and select the entry [Script trigger] from.

Set up script triggers for objects

In the dialog, select [Set script trigger] to select the event for which the desired script is to be executed. For objects, script triggers can be executed for the following events:

Script trigger events for objects

  • WithObjectEnter (Executes the script when entering an object)
  • WithObject keystroke (Executes the script within the object when a key is pressed. One keystroke is sufficient, the content of the object does not have to be changed. The script is triggered immediately each time a button is pressed within the object)
  • WithObjectChange (Executes the script when the object content changes. Compared to WithObject keystroke the content of the object must be changed in order to trigger the script. The script is triggered immediately each time the object content is changed)
  • WithObjectValidate (Executes the script as soon as a field is validated, even before the field is saved)
  • WithObjectSave (Executes the script when the field content is saved)
  • WithObjectExit (Executes the script when the object is exited. This can lead to the cursor not moving to the next field after the script has finished. This behavior can be remedied by executing the target script of the script trigger with the command Exit current script [Result: 0] is concluded.
  • When changing area (If the object is located in an area or tab control, the script is executed as soon as the user changes the area, e.g. selects a different tab)
  • WithObjectAVPlayerChange (Executes the script when the status of a media file in a layout object is changed, e.g. the playback of the media file is paused or stopped. This script trigger can only be run under FileMaker Go)

Assign script triggers to a layout

Script triggers can also be executed for a layout when certain events occur. To assign a script trigger to a layout, first switch to layout mode in the desired layout. Now select the menu command [Layouts > Layout setting] and select the tab [Script trigger] from.

Layout settings: Script Trigger

For layouts, script triggers can be executed for the following events:

Script trigger events for layouts

  • WithDatasetLoad (Executes the script as soon as a data record is called up in a layout)
  • WithSaveDataSet (Executes the script as soon as a data record is saved that was previously changed)
  • OnResetDataRecord (Executes the script when a data record is reset, e.g. via the menu command [Data records > Restore data record] or through the script step Discard change data/query)
  • WithLayout keystroke (Executes the script as soon as a key is pressed in the called layout)
  • WithLayoutEnter (Executes the script as soon as the corresponding layout is called up)
  • OnLayoutExit (Executes the script as soon as the corresponding layout is exited)
  • WithLayoutResize (Executes the script as soon as the window size is changed in the called layout)
  • ForModeChange (Executes the script as soon as the display mode is set to [Browse mode, Search mode, Page view mode] is changed manually or by a script step)
  • WithViewChange (Executes the script as soon as the view [Form, list or table view] is changed)
  • WithGestureType (Executes the script when a tap gesture is performed in a layout. This script trigger is only executable in Windows 8 and iOS)
  • WithExternalCommandReceive (Executes the script when the user is on the lock screen or on an external device. Stop, play, pause, change button "play/pause", next, rewind or fast forward resp. Rewind presses)

Assign script triggers to a database

Assign script triggers to a database to execute scripts automatically, for example when opening or closing the database. Script triggers can be assigned to a database by using the menu command [File > File options] and select the tab [Script trigger] is selected.

Define script triggers for a database

The following script triggers are available for the database under the file options:

Script trigger events for the database

  • AtFirstWindowOpen (Executes the script as soon as the database or the first window of the database is opened)
  • Close atLastWindow (Executes the script as soon as the database or the last window of the database is closed)
  • WithWindowOpen (Executes the script whenever a new window is opened manually or by script command)
  • WithWindowClose (Executes the script whenever a window is closed manually or by script command)
  • ForAVPlayer file change (Executes the script when the status of a media file is changed from a field or URL, e.g. the playback of the media file is paused or stopped. This script trigger can only be run under FileMaker Go)

More questions about FileMaker? It's quicker in person.

As part of our Coaching and training services we will be happy to inform you personally about the FileMaker functions you need for the development of your FileMaker solution. Of course, we will be happy to respond to your individual wishes. Billing is individual and fair in 15-minute increments. Pay conveniently by bank transfer or PayPal.

Related Einträge

Share this page:

ERP software as flexible as your company.
We will be happy to advise you.

Customizable ERP software for Mac, Windows and iOS.

You are here: What is a script trigger in FileMaker and how is it defined?