StableAction
Create record
Overview
Saves a new record in one of your entities, using the values of the surrounding form and/or values you set explicitly.
Purpose
This is the action behind every “Save”, “Book now” or “Send request” button. It runs on the server with the signed-in user's permissions, validates the data against the entity's fields, stores the record and starts any workflow that waits for a new record.
Inputs
- Entity — where the record is stored (Customers, Bookings, …).
- Use values from the surrounding form — when ticked, every input of the enclosing Form whose name matches a field key is saved automatically.
- Set fields / Also set — extra field values: pick a field, then give it a static value or dynamic data (Current user › email, Page parameters › id, Event › value, a text template…). Fields set here override form values.
Configuration
- Inside a Form component, leave Use values from the surrounding form ticked and make sure each input's Name equals the field key (
name,email,phone). - Outside a form (for example a “Mark as done” button), untick it and set the needed fields explicitly.
- Required fields without a value fail validation, so either put them in the form or set a default value on the field.
- System fields (created at, updated at, created by) are filled automatically and cannot be set.
Outputs
- Last result — the created record (all its fields plus
id,created_at,updated_at,created_by). - Last result id — the new record's id, handy for Go to page right after.
- Every action that returns something also updates last result (
Action results › last result) and last result id (last.id), so the next action can use it without naming a result key.
Example
Create a customer from a contact form — A Form with Name, Email and Phone inputs. On the form's On submit event:
Example
Create record
Entity: Customers
Use values from the surrounding form: yes
Also set:
Source = “Website”
Owner = Current user › emailErrors
- “Name is required”, “Email must be a valid email”, “Phone must be unique — “+1 555…” is already used” — validation errors from the entity's field rules; forms show them under the matching input.
- “Please sign in to create customers.” / “Your role can't create customers.” — the user's role has no create permission on the entity.
- “You can only create … that belong to you.” — an own-records rule requires a value (for example owner email) that does not match the current user.
- Too many requests — more than 60 creations per minute from one user or IP are rejected.
Limitations
- One record per action. Use Repeat for each or a workflow to create several.
- External (connected) entities are created through their connector; unique and relation checks only apply to built-in entities.
- If an action fails, the remaining actions in the list are skipped and an error message is shown to the user.
Advanced
- Schema:
{ type: "create_record", entityId, fromForm?, values?, resultKey? }. Executed on the server by reference (component + event + action id); the browser only sends the scope values. valueskeys may be field ids or keys; they are normalised to keys. After the insert,record_createdworkflows run, and when the event isonSubmitanyform_submittedworkflow for that form/entity runs with the form values as input.resultKeystores the record underAction results › <key>in addition tolast.