Enhancement proposal: Dynamic default values for Action form fields

Currently, Metabase Actions provide a useful way to write data back to the database, but the form configuration has several limitations that reduce usability for real-world workflows such as CRM-like data entry or record updates.

I would like to propose enhancements to support dynamic default values for Action form inputs.


Current limitations

1. Default values can only be set when the field is marked as required

At the moment, default values can only be specified if the field is configured as "required".

However, there are many cases where:

  • the field is optional

  • but still benefits from having a default value

For example:

  • optional comments

  • suggested values that users may override

  • pre-filled metadata fields

Allowing default values for optional fields would improve usability without affecting validation logic.


2. Default values must be static strings

Currently, default values can only be fixed text.

This significantly limits practical use cases where the value should depend on context.

For example:

  • editing an existing record and pre-filling the current value

  • copying the latest value from a history table

  • pre-filling values derived from query results

  • setting metadata such as the current Metabase user


Proposed enhancements

A. Allow default values for optional fields

Allow default values to be specified independently of the "required" setting.

Example:

Optional field with default suggestion:

Comment (optional)
Default value: "No comment"

B. Support dynamic default values via expressions or queries

Allow default values to reference:

1. Values from the source query

Example:

Default value:
{{record.current_status}}

2. Values retrieved from another query

Example:

SELECT status
FROM project_history
WHERE project_id = {{project_id}}
ORDER BY updated_at DESC
LIMIT 1

3. System variables related to the current Metabase session

Example:

{{MB_LOGIN_USER_ID}}
{{MB_LOGIN_EMAIL}}
{{MB_USER_NAME}}

This would allow automatic population of audit fields such as:

  • created_by

  • updated_by

  • owner_id


Example use cases

CRM-style workflows

When updating customer records:

Fields could be pre-filled with:

  • current values

  • last known values from history tables

  • user metadata

Example:

Field Default value
assigned_to {{MB_LOGIN_USER_ID}}
previous_status latest value from history table
updated_at NOW()

Editing existing records

When an Action is used to update an existing row:

Fields could automatically display the current stored values.

This avoids forcing users to re-enter unchanged data.


Audit trail automation

Automatically capturing the Metabase user performing the action would allow easier implementation of:

  • activity logs

  • approval workflows

  • ownership tracking


Expected impact

These improvements would:

  • reduce friction when using Actions for operational workflows

  • make Metabase more suitable for light CRM or workflow tooling

  • reduce errors caused by manual re-entry of existing values

  • improve auditability

Overall, this would significantly increase the value of Actions as a write interface, not only for simple inserts but also for structured operational workflows.


Optional implementation ideas

Possible approaches:

  • allow templating syntax similar to SQL variables

  • allow saved questions as default value sources

  • allow system variables for logged-in user context