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.
Stuck is a valid status
Need a second brain on this one?
If this lesson just collided with your real schema, script stack, or deadline, book consulting and turn the confusion into a concrete plan.
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.
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 ]
Sign in to track your progress and pick up where you left off.
Sign in to FM Dojo