# Layout Script Trigger

**URL:** <https://the.fmsoup.org/t/layout-script-trigger/2492>\
**Category:** Questions\
**Tags:** script, filemaker\
**Created:** [September 24, 2021, 1:48am UTC](https://the.fmsoup.org/t/layout-script-trigger/2492 "2021-09-24T01:48:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdphifer](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@bdphifer](https://the.fmsoup.org/u/bdphifer)\
**Post date:** [September 24, 2021, 1:48am UTC](https://the.fmsoup.org/t/layout-script-trigger/2492/1 "2021-09-24T01:48:49Z")

</div>

Is there a Script Trigger to do something when you first load a layout? I saw a reference to an "OnLayoutLoad" on an old (2010) Claris Community [post](https://community.claris.com/en/s/question/0D50H00006ezFYf/script-trigger-onlayoutload-triggers-on-exit-when-opening-a-new-window). Is this something that has disappeared in the many updates since then?

As a layout is first opened, I want to check to see if some JSON data is available and if it isn't call the script to create it.

Thanks!

---

<div class="post-metadata">

**Author:** ![planteg](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/planteg/32/627_2.png) [@planteg](https://the.fmsoup.org/u/planteg)\
**Post date:** [September 24, 2021, 3:34am UTC](https://the.fmsoup.org/t/layout-script-trigger/2492/2 "2021-09-24T03:34:31Z")

</div>

See [New Script Triggers in FileMaker Pro 11 and other Behavioral Changes (claris.com)](https://support.claris.com/s/article/New-Script-Triggers-in-FileMaker-Pro-11-and-other-Behavioral-Changes-1503692963813?language=en_US)

Extract

> **NOTE:** The name of OnLayoutLoad has been changed to OnLayoutEnter in FileMaker Pro 11 to match the OnLayoutExit trigger that has been added.

---

<div class="post-metadata">

**Author:** ![AndyHibbs](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/andyhibbs/32/3089_2.png) [@AndyHibbs](https://the.fmsoup.org/u/AndyHibbs)\
**Post date:** [September 24, 2021, 5:47am UTC](https://the.fmsoup.org/t/layout-script-trigger/2492/3 "2021-09-24T05:47:51Z")

</div>

Absolutely there is an OnLayoutEnter and a complementary OnLayoutExit.

We continue to be totally frustrated by the missing pair to the OnRecordLoad, which should be the OnRecordUnload or OnRecordExit. This missing layout script trigger results in many, many hours of work writing get arounds as we continue to abandon many of FileMaker’s legacy features to optimise it for use over the Internet.

If anyone else feels the same way, do please vote for this here:  
[https://community.claris.com/en/s/idea/0870H000000fyrGQAQ/detail](https://community.claris.com/en/s/idea/0870H000000fyrGQAQ/detail)

Unfortunately over the years there have been a number of these idea postings, so some of the voting has been diluted across these, but this one seems to now have the most traction

---

<div class="post-metadata">

**Author:** ![Malcolm](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/malcolm/32/196_2.png) [@Malcolm](https://the.fmsoup.org/u/Malcolm)\
**Post date:** [September 24, 2021, 8:46am UTC](https://the.fmsoup.org/t/layout-script-trigger/2492/4 "2021-09-24T08:46:05Z")

</div>

I've just visited the claris forum to ensure that idea gets my vote. I remember questioning whether there was a need for this trigger at the time you first raised the idea. Back then I thought it was possible to get by without it. Now I just want it.

---

<div class="post-metadata">

**Author:** ![AndyHibbs](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/andyhibbs/32/3089_2.png) [@AndyHibbs](https://the.fmsoup.org/u/AndyHibbs)\
**Post date:** [September 24, 2021, 9:09am UTC](https://the.fmsoup.org/t/layout-script-trigger/2492/5 "2021-09-24T09:09:35Z")

</div>

Thanks for this Malcolm

I’ve had a number of people question why we would want it, and often it is difficult to explain to developers who don’t follow our pattern of avoiding the use of field level validation, avoiding cross table calculations where possible and putting all the logic into scripts, mostly run by script triggers. All of which removes structural overheads and dramatically improves performance over lower bandwidth connections.

The inability to run these before leaving a record always ends up in a time consuming, less efficient compromise.

Kindest regards  
Andy

---

<div class="post-metadata">

**Author:** ![depotmaestro](https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/32.png) [@depotmaestro](https://the.fmsoup.org/u/depotmaestro)\
**Post date:** [September 26, 2021, 4:32pm UTC](https://the.fmsoup.org/t/layout-script-trigger/2492/6 "2021-09-26T16:32:34Z")

</div>

Just voted for this as well

---

<div class="post-metadata">

**Author:** ![bdphifer](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@bdphifer](https://the.fmsoup.org/u/bdphifer)\
**Post date:** [September 27, 2021, 7:18pm UTC](https://the.fmsoup.org/t/layout-script-trigger/2492/7 "2021-09-27T19:18:25Z")

</div>

Thanks for all the responses!!

The problem was, as I like to put it, between the keyboard and the chair. My script was calling for another layout to be opened, and FM was putting that layout on top of the original. The second layout was opened previously, so it looked like the layout was just changing. I have set up the line to open up the second layout so that the layout is opened off-screen.

Thanks again!!
