Freeze Window

According to post on Reddit, inserting ‘Freeze Window’ at the top of each script and after opening any additional windows can be useful in optimizing a script, “and can make your scripts run SIGNIFICANTLY faster”.

Anybody have insight into why this is the case and situations when this technique would be particularly beneficial?

1 Like

It makes a real difference when layout changes occur in scripts. GoToLayout is a slow script step.
Especially when going back and forth between layouts in loops, freezing the window (display) pays off. In addition, it improves the user experience by avoiding flickers.
If no layout changes occur, I don’t use it.


I typically open a new window (offscreen) to create a line item in a PO_LINES table or to create a record in an INVENTORY table. I’ll experiment with Freeze Window to see what affect this may have. Thanks — I appreciate your help.

To avoid heavy loads at specific points, I know developers who switch to Find-Mode first, perform goto Layout, etc. and then switch back to Browse-Mode.


This is a very effective technique when you are going to a layout to perform a find. I don't know how much you gain if you are going to switch to browse mode without doing a find. But in the case that you are going to search, then being in Find mode avoids loading data from one dataset unnecessarily.


It instructs the layout engine not to do anything so the advantage depend on your layouts and your script triggers. It can be a huge speed jump.

There is a small penalty to pay when you call freeze window because the window is drawn and committed to memory. That in itself takes time, so you don't want to call it unnecessarily, and don't put it in a loop!


Would also be great if the new window script step which allows setting of the layout since FM17 also preset its window mode...


A few other comments in addition to the good advice above, particularly Enter Find Mode before using Go To Layout.

During your script routines, don’t navigate to any layouts in Table View, this will be slower than Form View. For any layouts navigated to, ensure there are no summary fields on the layout. We normally have dedicated working layouts and also completely blank layouts, i.e. no objects/fields on these, for when we need to use Go to Layout. If using blank layouts and debugging would be easier viewing the data, putting in an If ( isEmpty ( $$debug ) ; Go to Layout [Blank] ; Go to Layout [Working]) option in the script helps.

Pretty much every script of ours starts with a ‘ScriptStart’ script containing Freeze Window, Allow User Abort [Off] and Set Error Capture [On] - we may also include Enter Browse Mode, alternatively we also have a Check Window Mode script that will prevent a button script running outside of Browse Mode.

I can’t imagine running a scripted process without Freeze Window being used, albeit we do occasionally use Refresh Window for various reasons.


would be interested to explain the "various reasons" - maybe starting new thread?

The Go To Layout step would benefit from an option I'd name like 'Open layout with empty found set'. One of my secret wishes.


Nothing particularly clever, for instance during a startup script that is setting various global fields and other preferences/defaults like smtp, imap servers, user IDs from the HR system, available merge fields, etc. then we’ll occasionally return to a startup layout that contains a global variable and adds a dot to the variable contents, hence with a refresh window included the user will just see ‘Starting.’, then ‘Starting..’, ‘Starting...’, etc. so they know something is happening.

Mostly, we just let things run after setting Freeze Window.

1 Like