Scripting
Script steps, patterns, error handling, and loops — the core of FileMaker development.
Bring the messy part
Scripting making a weird face at you?
Book consulting when the lesson makes sense, but your actual file has opinions. We can untangle the design, debug the snag, or map the next build.
How to pass a JSON parameter to a FileMaker script
Script parameters are a single text value. Learn why JSON is the right way to pass multiple values, and how to read them back inside a script.
FileMaker script error handling with Set Error Capture
Learn the mandatory error handling pattern for FileMaker scripts: suppress dialogs, check Get(LastError) after every risky step, and exit cleanly with diagnostic information.
Looping through a found set in FileMaker
Learn the reliable counter-loop pattern for iterating through records. Understand why "Exit after last" is unreliable and how to build loops that always terminate correctly.
FileMaker Set Variable — scope, naming, and when to use it
Understand the difference between local and global variables, when to use each, and the naming conventions that keep scripts readable.
FileMaker script triggers: OnObjectEnter, OnObjectExit, OnObjectSave, OnRecordCommit
Script triggers fire automatically in response to user actions. Learn the four most important object and record triggers and how to attach scripts to them without creating infinite loops.
Perform Script on Server (PSOS): when to use it and how it works
PSOS runs a script on the FileMaker Server engine instead of on the user's machine. Learn when it helps performance, what the headless environment means for your script design, and the difference between synchronous and asynchronous execution.
Go to Related Record: navigating via relationship in FileMaker
Go to Related Record (GTRR) is one of the most powerful navigation steps in FileMaker — and one of the easiest to misuse. Learn how to navigate to related records correctly and what "show only related records" actually does.
New Record and Delete Record script steps
Creating and deleting records programmatically are fundamental scripting tasks. Learn how to use New Record/Request and Delete Record/Request correctly, and how to confirm deletion with the user.
Set Field and Set Field By Name in FileMaker scripts
Set Field writes a value into a specific field. Set Field By Name uses a calculated field name, enabling dynamic field targeting. Learn both steps and when to use each.
Perform Find: scripting finds and handling error 401
Learn how to script a find in FileMaker using Enter Find Mode and Perform Find, set find criteria in variables, and gracefully handle the common error 401 "no records found" result.
Replace Field Contents: batch field updates in FileMaker
Replace Field Contents updates a field in every record in the current found set in a single step — making it the fastest way to batch-update data. Learn serial, value, and calculated replace modes.
Sort Records in FileMaker scripts
Learn how to sort a found set using Sort Records [Restore] and dynamic sort options, when to unsort for performance, and how Sort interacts with portals.
Show Custom Dialog: prompts, confirmations, and input fields
Show Custom Dialog lets you display a message with up to three custom buttons and up to three input fields. Learn how to read the button result and access field input from inside a script.
Exit Script [Result] and reading results with Get(ScriptResult)
FileMaker scripts can return a single value to their caller using Exit Script [Result]. Learn how to return structured JSON results, read them with Get(ScriptResult), and establish a consistent success/error pattern.
Sub-scripts: calling scripts from scripts in FileMaker
Breaking logic into reusable sub-scripts is the foundation of maintainable FileMaker development. Learn the parameter/result pattern, how to call sub-scripts, and how to structure a multi-script workflow.
Go to Portal Row and looping through portal rows in FileMaker
Portals display related records as rows, and Go to Portal Row lets you navigate and loop through each row in a script. Learn the portal loop pattern and how to avoid the common off-by-one mistake.
Using the FileMaker Script Debugger and Data Viewer
The Script Debugger and Data Viewer are FileMaker Pro's built-in debugging tools. Learn how to step through scripts, set breakpoints, and inspect variables and field values in real time.
Open URL: web links, mailto, and FileMaker deep links
The Open URL script step launches a URL in the default browser, opens a mail client with mailto:, or triggers another FileMaker file with an fmp:// deep link. Learn the syntax for each use case.
Insert from Device: camera, audio, and signature on FileMaker Go
Insert from Device lets FileMaker Go apps access the device camera, microphone, and signature capture. Learn how to insert media into container fields and handle the FileMaker Go-only limitation.
Window management in FileMaker: New Window, Adjust Window, Close Window
FileMaker supports multiple windows in a single session. Learn how to open new windows for modal-style workflows, resize and position them with Adjust Window, and close them cleanly from a script.
FileMaker script commenting conventions
Comments make scripts maintainable. Learn the # Comment step, the standard documentation header, and when a comment adds value vs when it just adds noise.
Commit Records/Requests: when and how to commit in FileMaker scripts
Commit Records/Requests writes in-progress field changes to the database. Learn when FileMaker commits automatically, when you must commit explicitly, and how to use "No dialog" to suppress the commit dialog.
Show All Records, Omit Record, and Omit Multiple Records in FileMaker
Found set management beyond Perform Find: learn how to restore the full found set, omit individual records, and build an inverse found set by omitting a subset.
Designing FileMaker scripts for Data API calls
Scripts called via the FileMaker Data API run headless with JSON in and JSON out. Learn the design patterns that make scripts reliable, testable, and safe to expose through the API.
Structured error trapping with OnError
Build bulletproof scripts by combining OnError [ Go to [label] ] with Get(LastError) lookup tables.
Passing complex data via JSON script parameters
Use JSONSetElement to bundle multiple values into a script parameter, and JSONGetElement to unpack them inside the called script.
Returning structured data from sub-scripts
Use Exit Script with a JSON result so calling scripts can check for errors and extract multiple return values.
Dynamic field targeting with Set Field by Name
Use Set Field by Name to write to a field whose name is computed at runtime, enabling generic scripts that work across multiple fields.
Loop optimization and found-set traversal
Cache counts, exit early, and avoid Go to Record [Next] to write loops that stay fast as record counts grow.
Insert from URL with cURL options
Make authenticated HTTP requests, send POST bodies, and set custom headers using Insert from URL with cURL options.
Advanced script triggers
Use OnObjectValidate, OnLayoutKeystroke, and OnWindowOpen to build responsive interfaces without polling.
Global variables in multi-user solutions
Understand global variable scope, per-session isolation, and when to use global fields instead.
Freeze Window for visual and performance optimization
Use Freeze Window to suppress screen redraws during long scripts, and learn when it actually improves speed.
Building scripted finds and compound requests
Use Enter Find Mode, Set Field, and Perform Find to script searches with multiple criteria, omit requests, and saved finds.
Multi-window management from scripts
Open, target, and close windows programmatically, and pass context between windows using script parameters.
InstallOnTimerScript for background automation
Run scripts on a repeating timer without user interaction using InstallOnTimerScript, and manage timer lifecycle correctly.
Commit and revert patterns in multi-step workflows
Control when records are written to disk using Commit Records/Requests and Revert Record/Request for transaction-like safety.
Scripting portal row operations
Create, update, and delete related records through portal rows from scripts, and understand commit behavior in portal context.
Allow User Abort and script cancellation control
Control whether users can cancel a running script with Escape, and communicate progress so they do not feel locked out.
Script workspace organization and naming
Apply naming conventions, folder structure, and documentation practices that keep the script workspace navigable as solutions grow.
Perform Script via URL (Deep Links)
Use the fmp:// URL scheme to open a FileMaker file and run a script from a browser, email link, or external application.
Variable scoping: local vs global variables
Understand how FileMaker scopes $local and $$global variables and avoid the pitfalls each carries in multi-user solutions.
Exit Script with result: structured return patterns
Return structured data from sub-scripts using Exit Script with JSON results, and consume them reliably in parent scripts.
Perform Find patterns: find, constrain, extend, and omit
Master the four find operations -- Perform Find, Constrain Found Set, Extend Found Set, and Omit -- to build precise, composable searches in scripts.
Delete All Records safely with confirmation and privilege guards
Use confirmation dialogs, RunWithFullAccess, and pre-delete checks to prevent accidental data loss when scripting bulk deletes.
Go To Object: naming conventions and targeting popovers and slides
Use Go To Object reliably by following consistent object naming conventions and learn how to open popovers and navigate slide panels from scripts.
Install Menu Set: custom menus and restoring default menus
Create and install custom menu sets to restrict or extend FileMaker's menu bar, and restore the default menu set on exit.
Set Variable chaining for JSON construction
Build complex JSON payloads incrementally using chained Set Variable steps and FileMaker's JSON functions.
Recursive scripts with a counter guard
Write self-calling FileMaker scripts for tree traversal and recursive data processing, protected by a depth counter to prevent infinite loops.
Script continuation and halt: Halt Script, Exit Script, and Allow User Abort
Control script termination precisely using Halt Script, Exit Script, and Allow User Abort Off to build safe, uninterruptible workflows.
Perform Script with parameter: JSON encoding and decoding
Pass structured data between scripts by encoding parameters as JSON objects and decoding them with JSONGetElement in the receiving script.
Commit Records: skip validation and no-dialog flags
Use Commit Records/Requests flags to control data-entry validation, dialog suppression, and silent commits in scripted workflows.
Open URL from a FileMaker script
Launch web pages, mailto links, and custom URL schemes from scripts using the Open URL step, with error handling for unsupported schemes.
New Record / Request with scripted default values
Create new records programmatically and populate default values immediately to ensure data integrity and a smooth user experience.
Complex multi-request finds with Find mode scripting
Build AND, OR, and NOT find logic using multiple find requests, omit criteria, and dynamic field criteria set from script variables.
Sort Records patterns in scripts
Script dynamic and multi-level sorts, detect the current sort state, and manage sort performance on large found sets.
Export Records automation from scripts
Automate CSV, Excel, and XML record exports from FileMaker scripts with dynamic file paths, field order control, and error handling.
Import Records automation in FileMaker scripts
Automate CSV and XML record imports from scripts, control field mapping, detect import errors, and handle duplicates with a match field strategy.
Replace Field Contents safely in FileMaker scripts
Use Replace Field Contents for bulk field updates with confirmation guards, found-set scoping, and rollback planning to prevent mass data overwrites.
Send Mail via SMTP using Insert from URL
Send transactional email from FileMaker scripts by calling an SMTP relay API with Insert from URL, avoiding the native Send Mail step's client dependency.
Script design patterns: single responsibility and naming
Structure FileMaker scripts around single responsibilities and apply consistent naming conventions so solutions remain maintainable as they grow.
Error recovery patterns: the FileMaker Try-Catch equivalent
Implement structured error recovery in FileMaker scripts using OnError labels, error translation tables, and cleanup routines that mirror try-catch patterns.
Modular script libraries in FileMaker
Design reusable, table-agnostic utility scripts and organize them into a logical library that any part of your solution can call.
Script versioning strategy in FileMaker solutions
Track script changes across deployments using version fields, a change log table, and a disciplined update workflow that avoids breaking production.
Performance profiling FileMaker scripts
Identify slow script steps using timestamps, the Data Viewer, and the Script Debugger to find and fix performance bottlenecks in production scripts.
Bulk operations design in FileMaker scripts
Design large-scale batch scripts that handle errors per-record, report progress, respect user cancellation, and finish with a summary report.
Script documentation standards for FileMaker solutions
Write in-script comment blocks and external documentation that enables any developer to understand, maintain, and safely modify a script they did not write.
Testing FileMaker scripts systematically
Apply unit testing principles to FileMaker scripts using test scripts, assertion patterns, and a test runner to catch regressions before deployment.
Debugging advanced FileMaker script issues
Use the Script Debugger, Data Viewer, logging, and systematic isolation to diagnose complex FileMaker script bugs that only occur in production.
Script security review checklist for FileMaker solutions
Audit FileMaker scripts for injection vulnerabilities, privilege escalation paths, exposed credentials, and unsafe user-input handling before deployment.