New Record and Delete Record script steps
BeginnerCreating 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.
What you'll learn
- How to create a new record and immediately populate fields
- How to safely delete a record with user confirmation
- How to handle errors from both steps
New Record/Request creates a blank record on the current layout's table, while Delete Record/Request permanently removes the current record — both require careful error handling and, for deletion, user confirmation.
1/2
1
Create a new record and populate it
New Record/Request creates a blank record and makes it the current record. Follow it immediately with Set Field steps to populate the required fields.
FileMaker Script
Set Error Capture [ On ] Go to Layout [ "Invoices" (Invoices) ] New Record/Request Set Variable [ $error ; Value: Get ( LastError ) ] If [ $error ≠ 0 ] Exit Script [ Result: $error ] End If Set Field [ Invoices::customerId ; $customerId ] Set Field [ Invoices::date ; Get ( CurrentDate ) ] Set Field [ Invoices::status ; "Draft" ] Commit Records/Requests [ No dialog ] Set Variable [ $newId ; Value: Invoices::id ]
Go to Related Record: navigating via relationship in FileMakerSet Field and Set Field By Name in FileMaker scripts
Sign in to track your progress and pick up where you left off.
Sign in to FM Dojo