Skip to content

Actions

Actions are operations that run in response to user interactions. They enable your app to create, update, and delete data, navigate between views, and provide feedback to users.

Actions are reusable operations that can be:

  • Triggered by button clicks
  • Executed on row clicks in lists
  • Chained together for complex workflows
  • Configured with dynamic values using formulas

EmberBlocks provides several built-in action types:

ActionDescriptionCommon Use Cases
Create RowInsert a new recordAdding new items, creating orders
Update RowModify an existing recordEditing details, changing status
Delete RowRemove a recordDeleting items, cleanup
NavigateGo to another viewPage navigation, detail views
Open URLOpen an external linkExternal resources, documents
Show MessageDisplay a notificationSuccess/error feedback
Run FormulaExecute a formulaCalculations, data validation

To create a new action:

  1. Open your app and go to the Actions tab
  2. Click + Create in the sidebar
  3. Configure the action settings
  4. Save and use in your components

Insert a new record into a table:

SettingDescription
TableThe target table for the new row
Field ValuesValues to set for each field

For each field, you can specify:

  • Static Value - A fixed value like “pending” or “0”
  • Formula - A dynamic value like {{$user.id}} or NOW()

Example configuration:

Table: orders
Field Values:
- customer_id: {{$user.id}}
- status: "pending"
- created_at: NOW()
- total: 0

Modify an existing record:

SettingDescription
TableThe table containing the row
Row ReferenceWhich row to update (usually $row)
Field ValuesFields to update with new values

Example configuration:

Table: orders
Row: {{$row}}
Field Values:
- status: "completed"
- completed_at: NOW()
- completed_by: {{$user.id}}

Remove a record from a table:

SettingDescription
TableThe table containing the row
Row ReferenceWhich row to delete

Example configuration:

Table: orders
Row: {{$row}}

Go to another view in your app:

SettingDescription
Target ViewThe view to navigate to
ParametersURL parameters to pass

Example configuration:

Target View: order-details
Parameters:
- id: {{$row.id}}

The target view can access parameters via $params:

{{$params.id}}

Open an external URL in a new tab:

SettingDescription
URLThe URL to open (supports formulas)

Example configuration:

URL: https://maps.google.com/?q={{$row.address}}

Display a notification to the user:

SettingDescription
MessageThe text to display (supports formulas)
Typesuccess, error, info, or warning

Example configuration:

Message: "Order #{{$row.id}} has been updated"
Type: success

Execute a formula and optionally store the result:

SettingDescription
FormulaThe formula expression to evaluate

Example:

Formula: SUM(FILTER(items, items.order_id = $row.id).price)

The most common way to trigger actions:

  1. Add a Button component to your view
  2. In the button settings, select Action
  3. Choose the action to trigger
  4. Configure any action-specific settings
SettingDescription
ActionSelect the action to trigger
Disabled ConditionFormula for when button is disabled
Confirm DialogShow confirmation before running
Confirm MessageCustom confirmation message

Actions can trigger on row interactions:

SettingDescription
Row Click ActionAction when a row is clicked
Row Double ClickAction on double-click

For destructive or important actions, enable confirmation:

  1. In the button settings, enable Confirm Dialog
  2. Set a custom Confirm Message
  3. Users must click “Confirm” before the action runs

Example message:

Are you sure you want to delete "{{$row.name}}"? This cannot be undone.

Actions have access to context variables when executed:

VariableDescriptionAvailability
$rowCurrent row (in list context)List row click, row actions
$selectedRowsSelected rowsBulk action buttons
$userCurrent authenticated userAll actions
$appCurrent app metadataAll actions
$paramsURL parametersAll actions

Perform actions on multiple selected rows:

  1. Enable row selection in your List component
  2. Add a button with an action that uses $selectedRows
  3. The action runs for each selected row

Example - Delete Selected:

Table: items
Row: {{$selectedRows}}

The action will delete all selected items.

Chain multiple actions to run in sequence:

  1. Create individual actions for each step
  2. Use the Action Chain configuration
  3. Define the execution order
  4. Optionally add conditions between steps

Example workflow:

  1. Validate - Check required fields
  2. Create Order - Insert the order record
  3. Create Items - Insert order line items
  4. Show Message - Display success notification
  5. Navigate - Go to order confirmation
SettingDescription
ActionsOrdered list of actions to run
Stop on ErrorStop chain if any action fails
ConditionOptional condition before each action

EmberBlocks provides automatic error handling:

  • Failed actions show an error notification
  • Database errors display user-friendly messages
  • Network issues trigger retry prompts

Configure custom error handling:

SettingDescription
Error MessageCustom message to show on failure
Error ActionAction to run on failure (optional)

Create a record with minimal input:

Action: Create Row
Table: tasks
Field Values:
- title: "New Task"
- status: "draft"
- created_by: {{$user.id}}
- created_at: NOW()

Change a record’s status:

Action: Update Row
Table: orders
Row: {{$row}}
Field Values:
- status: "shipped"
- shipped_at: NOW()

Open a detail view for a row:

Action: Navigate
Target View: customer-details
Parameters:
- id: {{$row.id}}

Delete with confirmation:

Action: Delete Row
Table: items
Row: {{$row}}
Button Settings:
- Confirm Dialog: enabled
- Confirm Message: "Delete {{$row.name}}?"

Open a URL based on row data:

Action: Open URL
URL: {{$row.document_url}}

Show confirmation after save:

Action: Show Message
Message: "Changes saved successfully"
Type: success

Use clear, descriptive names:

  • “Create Order” instead of “Action 1”
  • “Mark as Complete” instead of “Update”
  • “Delete Customer” instead of “Remove”

Always confirm destructive actions:

  • Delete operations
  • Bulk updates
  • Irreversible changes

Provide helpful error context:

"Unable to save order. Please check all required fields are filled."

Validate before CRUD operations:

  • Check required fields aren’t empty
  • Verify numeric values are in range
  • Confirm relationships exist

Always provide feedback:

  • Success messages after saves
  • Error messages with helpful context
  • Loading states during operations
IssueCauseSolution
Action not triggeringButton not configuredCheck action is assigned to button
Wrong row affectedIncorrect row referenceVerify $row context is available
Field value errorsInvalid formulaCheck formula syntax and field names
Navigation failsInvalid view slugVerify target view exists
  1. Test actions with simple static values first
  2. Check browser console for detailed errors
  3. Verify table and field names are correct
  4. Ensure required permissions are granted
  • Actions respect user role permissions
  • Users can only modify data they have access to
  • Admin actions should have explicit role checks
  • Validate input on both client and server
  • Sanitize user-provided values
  • Check for SQL injection in dynamic queries
  • Consider logging important operations
  • Track who performed destructive actions
  • Maintain history for compliance needs

Continue building your EmberBlocks app: