How to avoid script triggers ruining your day

Script triggers are your best friend and worst enemy. They are great when they trigger as required but not always so good when you don’t want the scripts to run.

For example when opening a new window, if you are on a layout with ‘on layout load’ or ‘on record load’ these scripts will run. This can be unhelpful if all you want to do is go to another layout set some fields and close the window.

Here are two ways to avoid the pain.

You can stop using the New Window command and replace it with Goto Related Records. Create a relationship based on the primary key, Goto Related records with ‘match all in found set’ checked going to a layout without any triggers.


Have a $$Variable which is checked at the start of the scripts to be triggered.

If ( $$Variable = “Exit”)

Exit Script (true)


On the script which is opening the new window set $$Variable to “Exit” at the start and blank at the end and the scripts will be triggered but instantly finish.

The only down side to Option one is more relationships

The only down side to Option two is you have to Set $$Variable to blank at each point the running script could exit.

Simon Ward

Simon has been developing FileMaker databases since the late 90s and joined Linear Blue in 2006. Over this time he has developed database systems for clients in many different industries from Order Processing to Book Publishing. Simon’s BSc in Chemistry from Thames Valley University comes to the fore in his analytical skills and he is certified in FileMaker versions 7 through 12.

More Posts - Website

2 thoughts on “How to avoid script triggers ruining your day”

  1. Another way to prevent scripts from triggering automatically when the event is generated by another script is to adopt a naming convention for scripts that should not cause triggers to fire. For example, put “(noTrigger)” in the name of the script whose actions should not activate script triggers. When you set script triggers, pass Get( ScriptName ) as a parameter, then check for this in the onTrigger script:

    if [ PatternCount( Get( ScriptParameter ); “(noTrigger)” ) > 0 ]
    Exit ScrIpt
    End If

    If the script is triggerd by user action instead of from another script, the parameter will be empty and the test will fail, causing the desired trigger actions to be executed.

    This method avoids the chance of forgetting to reset a global variable (thereby screwing up triggers downstream).

Leave a Reply