Module guide
Formula fields
Tenant-authored computed fields with a deterministic AST.
Overview
Create read-only computed fields on tasks, projects, and goals using the same FormulaNode AST that powers Views v2 conditional formatting. Examples: days until due, an overdue-and-HIGH flag, or an estimate-plus-recurrence score.
Highlights
The capabilities worth knowing before you dive in.
- AST nodes: literal, field, compare, logical, not, between, dateDiffDays, and match
- Zod-validated on write, so malformed payloads can never reach the evaluator
- /formula-fields/:id/evaluate runs the formula over a batch of rows in one call
Important to know
Limits, permissions, and sharp edges to keep in mind.
- Formulas are pure, with no side effects and no external calls.
- Evaluation is O(rows by ast-size). Batch the call for large corpora.
How to use it
The primary workflow, start to finish.
- POST /formula-fields with a scope, name, and AST.
- POST /formula-fields/:id/evaluate with a rows[] array to compute.
- Reference the field in Views v2 as a grouping or formatting key (future release).
FAQ
- Can a formula field write back to the record?
- No. Formula fields are read-only and pure: no side effects and no external calls. They compute a value for display and for filtering, and the underlying fields are unchanged.
- Is there a limit to how many rows I can evaluate?
- There is no hard limit, but the cost grows with the number of rows multiplied by the size of the expression. Use the batch evaluate endpoint to run one formula over many rows in a single call rather than one call per row.
- Where else does this expression language appear?
- The same abstract syntax tree powers conditional formatting in Views. A rule you understand in one place reads the same way in the other, and both are validated on write so a malformed expression never reaches the evaluator.
Automate this module
Everything on this screen is scriptable. Drive it from the REST API, or let an AI agent run it through the MCP server.
Was this page helpful?