Script trigger

What is a script trigger in FileMaker?

Script triggers are used in FileMaker to automatically execute a script during certain user interactions. 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, during an event, or after an event.

Assign script trigger to an object

To assign a script trigger to an object such as a field, you first switch to Layout mode on the layout in your FileMaker database. Now right-click the desired object and choose [Script Triggers] from the shortcut menu.

Set up Script-Trigger for objects

In the dialog [Set Script Triggers] select the event for which the desired script should be executed. For objects, script triggers can be executed for the following events:

Script trigger events for objects

  • OnObjectEnter (Runs the script when entering an object)
  • OnObjectKeypress (Executes the script when a key is pressed inside the object. One keystroke is sufficient, the content of the object does not need to be changed. The script is triggered immediately each time a key is pressed within the object)
  • OnObjectChange (Executes the script when the object content is changed. Compared to OnObjectKeypress the content of the object must be changed to trigger the script. The script is triggered immediately whenever the object content is changed)
  • Validate onObjectValidate (Runs the script as soon as a field is validated and before the field is saved)
  • AtSaveObject (Runs the script when the field contents are saved)
  • OnObjectExit(Executes the script when the object is exited. In this case, it may cause the cursor not to jump to the next field after the script has ended. This behavior can be corrected by closing the target script of the script trigger with the command Leave Current Script [Result: 0].)
  • OnRange Change(If the object is in a range or tab control, the script is executed as soon as the user changes the range, e.g. selects another tab)
  • OnObjectAVPlayerChange(Executes the script when the status of a media file in a layout object is changed, e.g. when the media file playback is paused or stopped. This script trigger only works under FileMaker Go)

 

Assign a script trigger to a layout

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

Layout settings: Script-Trigger

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

Script trigger events for layouts

  • Load atRecord (Runs the script whenever a record is called on a layout)
  • SaveOnRecord (Runs the script as soon as a record is saved that was previously modified)
  • AtLayoutKeypress (Executes the script as soon as a key is pressed in the called layout)
  • OnLayoutEnter (Runs the script as soon as the corresponding layout is called)
  • OnLayoutExit (Runs the script as soon as the corresponding layout is exited)
  • OnLayoutResize (Runs the script as soon as the window size is changed in the called layout)
  • Change onMode (Executes the script as soon as the corresponding layout is set to display mode [Browse mode, Find mode]

 

 

Related entries

Diesen Beitrag bewerten:

About Author

Markus Schall
Development of FileMaker databases since 1994, modification and extension of FileMaker solutions, conversion of FileMaker databases from .fm, .fp3, .fp5 (FileMaker 2-6) or .fp7 (FileMaker 7-11) to .fmp12 (FileMaker 12-17), interfaces to third-party systems such as online shops, CMS or other databases. Development of individual FileMaker database systems based on the gFM business framework with personal advice from Oldenburg. Operator of the online specialist portal goFileMaker.de, developer of the CRM and merchandise management system gFM-Business. Member of FileMaker Business Alliance, FileMaker Developers Subscription and FMM Expert. Winner of an FMM Award 2011, awarded by the FileMaker Magazine.