Skip to content

Templates

Purpose

Templates define reusable metadata shapes for entities.

They help developers and authorized users create consistent objects without writing a new schema, form, and CRUD flow for every variation.

What A Template Controls

A template may define:

  • entity type,
  • property groups,
  • property definitions,
  • tag groups,
  • default tags,
  • default property values,
  • allowed child entity types,
  • allowed relationship types,
  • display layout hints,
  • validation rules.

Example: BACnet Controller Template

text
Template: BACnet Controller
Entity Type: asset

Property Groups:
├── Device
├── Network
└── BACnet

Tag Groups:
├── Vendor
├── Criticality
└── Commissioning Status

Allowed Relationships:
├── uses -> credential
├── connects_to -> asset
└── depends_on -> asset

Example: Site Template

text
Template: Standard Customer Site
Entity Type: site

Property Groups:
├── Address
├── Network Access
└── Service Notes

Allowed Children:
├── building
├── asset
└── connection_method

Template Tables

Core table:

text
entity_templates

Associations:

text
entity_template_property_groups
entity_template_tag_groups
entity_template_allowed_children
entity_template_allowed_relationships

Only implement the associations needed for current product scope.

Template Application

Creating an entity from a template should:

  1. validate template is active,
  2. validate actor has permission,
  3. create entity,
  4. create required default property values,
  5. attach default tags,
  6. apply optional defaults,
  7. emit audit event.

Template Versioning

Do not overbuild versioning immediately.

Recommended approach:

  • Alpha: templates are mutable metadata.
  • Later: add versioning if changes need historical reproducibility.

Versioning becomes important when:

  • templates drive compliance,
  • generated forms must reflect historical state,
  • audits require knowing exactly which template version created an entity.

Template vs Entity Type

Entity type answers:

text
What kind of thing is this?

Template answers:

text
What shape/configuration should this thing use?

Example:

text
Entity Type: asset
Templates:
- BACnet Controller
- Head-End PC
- Network Switch
- UPS
- Modbus Gateway

Developer Guidance

Use templates to reduce duplication.

Do not use templates to hide complex workflow logic.

For complex workflows, create application services and use templates only to provide metadata and defaults.

Frontend Guidance

Templates can drive:

  • initial form sections,
  • required fields,
  • available tag groups,
  • display order,
  • default values.

The frontend should still use explicit application code for complex flows such as:

  • credential creation,
  • remote access setup,
  • approval workflows,
  • Simpro sync,
  • asset commissioning flow.