Actions have three scopes that determine how they trigger and which records they target. The context object provides access to form values, selected records, and user information.
Action scopes
Single scope
Execute on one specific record.
Use when:
- Sending an email to a specific user
- Generating an invoice for one order
- Viewing details of a single item
- Resetting a user’s password
Context methods:
context.getRecord(fieldNames) - Get the selected record
context.getRecordId() - Get the record ID
Bulk scope
Execute on multiple selected records simultaneously.
Use when:
- Archiving multiple items
- Updating status of several records
- Sending mass emails
- Bulk deleting records
Context methods:
context.getRecords(fieldNames) - Get all selected records
context.getRecordIds() - Get array of record IDs
Handle failures gracefully in bulk actions. Decide whether to stop on first error or continue processing remaining records.
Global scope
Execute at collection level without selecting specific records.
Use when:
- Importing data from CSV
- Generating collection-wide reports
- Syncing with external services
- Running maintenance tasks
Context methods:
context.filter - Access current filters and search
context.collection - Query the collection
- No specific records are pre-selected
The context object
The context object is passed as the first argument to the execute handler and provides access to all action data.
Access values entered by the user in the form:
Selected records
Get data from the records the action is running on:
Current user
Access information about who triggered the action:
Access the collection schema and query interface:
Filters
For Bulk and Global actions, access current filters from the UI:
This filter represents the current segment, search, and filters applied in the Forest interface.
Change detection
Check if a form field value has changed (useful for dynamic forms):
Examples
Example: Access record data
Example: Update selected records
Example: Bulk processing with error handling
Example: Use user context
Example: Global action with filters