Mutations
Mutation actions modify records in your database. Use them to create related records, update values, or cascade deletions. Open any automation in Automation from the top navigation and click Add Condition, Record or Action to add a mutation.
Operation types
| Operation | Description |
|---|---|
| Create | Insert a new record into a collection |
| Update | Modify existing records matching conditions |
| Delete | Remove records matching conditions |
Configuration
| Field | Required | Description |
|---|---|---|
| Operation | Yes | Create, Update, or Delete |
| Collection | Yes | Target collection to modify |
| Field Mappings | For Create/Update | Map values to collection fields |
| Conditions | For Update/Delete | Filter which records to affect |
Create operation
Insert a new record with specified field values.
Field mapping
Map source values to target fields. Click the + icon next to value inputs to select available fields and variables.
| Target field | Source value |
|---|---|
customerId | {{order.customerId}} |
orderId | {{order.id}} |
status | pending |
createdAt | {{order.createdAt}} |
Example: Create audit log
Trigger: When order created (alias: order)
Action: Mutation (Create)
Collection: AuditLogs
Fields:
- action = "order_created"
- recordId = {{order.id}}
- userId = {{order.userId}}
Update operation
Modify existing records that match your conditions.
Conditions
Specify which records to update:
| Field | Operator | Value |
|---|---|---|
id | = | {{user.managerId}} |
Field mapping
Set new values for the matching records.
Example: Update related record
Trigger: When employee created (alias: employee)
Action: Mutation (Update)
Collection: Departments
Conditions:
- id = {{employee.departmentId}}
Fields:
- employeeCount = {{department.employeeCount}} + 1
Delete operation
Remove records matching your conditions.
Example: Cascade delete
Trigger: When user deleted (alias: user)
Action: Mutation (Delete)
Collection: UserSessions
Conditions:
- userId = {{user.id}}
Field types in mappings
| Source | Syntax | Example |
|---|---|---|
| Trigger data | {{triggerAlias.field}} | {{order.customerId}} |
| Record query | {{recordAlias.field}} | {{manager.email}} |
| Variable | {{variableName}} | {{calculatedTotal}} |
| Static value | Direct value | "pending" |
Use cases
- Audit trails — Create log entries when records change
- Auto-assign — Set default values on new records
- Cascade updates — Update related records when parent changes
- Data sync — Keep denormalized data in sync
- Cleanup — Delete orphaned records
Best practices
- Use conditions carefully — Avoid unintended bulk updates
- Test with a single record — Verify behavior before processing many records
- Consider execution phase — "Before" mutations affect the triggering operation
- Log before mutating — Add a Logger action to verify values during development
Related
- Update Trigger Record — Modify the triggering record directly
- Logger — Debug mutation values before executing
- Conditions — Add conditional logic before mutations