form_templates

This table stores reusable form definitions created inside DirtView. Each row represents a template such as a Daily Log, PTP, Safety Inspection, or other configurable field form.

Domain: Workflow Engine / Forms
Scope: Tenant
Status: Proposed
Last Updated: 11 Apr 2026
Mutable: Limited by product rules
Primary Owner: Forms Service / Core API
RLS Applies: Yes
Client Facing: Yes

Purpose

The purpose of this table is to store the reusable schema and metadata for a form template that can be filled out many times by users in the field or office.

What this table does

  • Stores the definition of a reusable form
  • Captures the full form structure as JSON schema/configuration
  • Provides metadata such as name, version, creator, and defaults
  • Acts as the parent definition for many form submissions

Why this table is defined

DirtView’s forms system is a major product differentiator. Templates must be reusable, version-aware, and independent from the submissions users create from them.

Columns

Column Type Required Description Example
iduuidYesPrimary key for the form templateftpl_001
tenant_iduuidYesTenant owning the templatetenant_001
nametextYesTemplate display nameDaily Log
descriptiontextNoOptional descriptionStandard daily field reporting form
versionintYesTemplate version number1
schemajsonbYesFull component tree / form schema{"fields":[...]}
created_byuuidNoUser who created the templateuser_100
default_distribution_group_iduuidNoOptional default distribution groupdgroup_015
is_activebooleanYesWhether the template can be usedtrue
metadatajsonbYesExtra template metadata{"category":"safety"}
created_attimestamptzYesCreation timestamp2026-04-11 09:00:00+00
updated_attimestamptzYesLast update timestamp2026-04-11 09:30:00+00

Relationships

How it is used

  • Rendered by the form builder and form-filling UI
  • Selected when a user begins a form submission
  • Used to generate the initial field structure for submissions
  • Used for admin review, export, and reporting context

Access and security

  • Template creation/editing should be restricted to authorized users
  • Template schema changes should be version-aware
  • Field-level RBAC may eventually apply to parts of the schema

Example scenarios

Scenario 1: Daily Log template

A tenant creates a Daily Log template with crew, hours, photos, and notes fields.

Scenario 2: Safety inspection template

A Safety Manager defines a reusable form for recurring site inspections.

Scenario 3: Distribution defaults

A template is configured to notify a specific group whenever it is submitted.

Notes and assumptions

  • The submission should store a snapshot of the template version used
  • Do not overwrite historical meaning of old versions
  • JSON schema design quality is very important here