New Record / Request with scripted default values
BeginnerCreate new records programmatically and populate default values immediately to ensure data integrity and a smooth user experience.
What you'll learn
- How to create a new record and set initial field values in a script
- How to set defaults that depend on runtime context (current user, related records)
- When to commit immediately vs leave the record in edit mode
- How to navigate to the new record after creation
- How to handle commit errors on newly created records
FileMaker's auto-enter field options handle simple defaults, but scripted record creation lets you set defaults that depend on runtime context -- the current user, a related record value, a calculated date, or a value passed from another script. The pattern is: New Record/Request, Set Field for each default, then either commit immediately or leave in edit mode for the user to complete.
Create a new record and set context-aware defaults
After New Record/Request, FileMaker is in record-edit mode on a blank new record. Use Set Field steps to populate defaults. These can reference Get functions, related fields, variables, or script parameters -- not just literal values.
# Script: New Project from Client # Parameter: clientID Set Variable [ $clientID ; Value: Get ( ScriptParameter ) ] Go to Layout [ "Projects" (Projects) ; Animation: None ] New Record/Request Set Field [ Projects::ClientID ; $clientID ] Set Field [ Projects::CreatedBy ; Get ( AccountName ) ] Set Field [ Projects::CreatedDate ; Get ( CurrentDate ) ] Set Field [ Projects::Status ; "Active" ] Set Field [ Projects::DueDate ; Get ( CurrentDate ) + 30 ]
Sign in to track your progress and pick up where you left off.
Sign in to FM Dojo