Skip to main content
See also: Domain Model Types | Properties | Relationships

Constraint Types Overview

diagram Powersheet supports three constraint types:
Constraint TypePurposeWhen Applied
loadFilters which entities are loaded and displayed in the sheetAt query/load time
createSpecifies default values for newly created entitiesAt entity creation time
pickFilters which entities appear in selection dropdownsWhen opening a picker dialog

Constraint Properties

All three constraint types share the same document sub-properties for document-based filtering:
NameTypeDefaultDescription
constraintsobjectNoneTop-level constraint container for an entity type. Contains load, create, and/or pick sub-objects.
loadobjectNoneQuery constraint defining which entities to load. Filters entities based on document properties or other criteria.
createobjectNoneDefault value constraint specifying initial values for newly created entities.
pickobjectNonePicker constraint filtering which entities appear in selection dropdowns when creating relationships.

Document Constraint Properties

Each constraint type accepts a document object with the following properties:
NameTypeDefaultDescription
documentobjectNoneDocument-based constraint object specifying document properties for filtering or defaults.
document.moduleFolderstringNonePolarion module folder (space) path for document location constraints.
document.moduleNamestringNonePolarion module (document) name for exact name matching.
document.typestringNonePolarion document type for constraints. Filters documents by their type classification.
document.componentstringNonePolarion component for constraints. Supports $context references for dynamic scoping.

Load Constraints

Load constraints filter which entities are visible when loading data into the sheet. They apply query-time filtering based on document properties.
domainModelTypes:
  UserNeed:
    polarionType: userNeed
    constraints:
      load:
        document:
          type: specification
    properties:
      title:
      description:
Load constraints operate at the domain model level and affect all queries for this entity type. For per-source query filtering, use the where clause in the Sources configuration.

Create Constraints

Create constraints restrict where new work items of a specific type can be created, specifying the target document for new entities.
domainModelTypes:
  SystemRequirement:
    polarionType: systemRequirement
    constraints:
      create:
        document:
          moduleFolder: Requirements
          moduleName: System Requirements
          type: systemSpecification
    properties:
      title:
      description:
      severity:
When a user creates a new SystemRequirement, it will automatically be placed in the document at Requirements/System Requirements with the systemSpecification document type.

Pick Constraints

Pick constraints filter which entities are available in relationship picker dialogs. They scope the options users see when selecting linked items.
domainModelTypes:
  DesignRequirement:
    polarionType: designOutput
    constraints:
      pick:
        document:
          moduleFolder: Design
          type: designSpecification
    properties:
      title:
      description:
Pick constraints only affect picker dialogs — they do not filter entities already loaded in the sheet. Use load constraints to filter the main entity list.

Dynamic Context References

Constraints can use $context references for dynamic scoping based on the source entity’s properties:
domainModelTypes:
  SystemRequirement:
    polarionType: systemRequirement
    constraints:
      pick:
        document:
          component: $context.source.document.component
    properties:
      title:
      description:
Context ReferenceDescription
$context.source.documentReference to the source entity’s document properties.
$context.source.document.componentDynamically resolves to the component property of the source entity’s document.
Constraints can also be applied to individual navigation properties within relationships, enabling context-aware filtering on specific expansion paths:
relationships:
  - from: UserNeed
    to: SystemRequirement
    cardinality: one-to-many
    storage: linkedWorkItems
    linkRole: refines
    direct:
      name: systemRequirements
    back:
      name: userNeeds
      constraints:
        load:
          document:
            component: $context.source.document.component
This configuration filters the userNeeds back-navigation to only include items from documents with the same component as the source entity’s document.

Source-Level Constraints

The sheet configuration sources section supports applyCurrentDocumentTo, which constrains a specific entity type to the current document context:
sources:
  - id: requirements
    title: Requirements
    model: rtm
    query:
      from: UserNeed
    constraints:
      applyCurrentDocumentTo: SystemRequirement
    expand:
      - name: systemRequirements
        title: System Requirements

Complete YAML Example

domainModelTypes:
  Document:
    properties:
      title:
      type:

  Chapter:

  UserNeed:
    polarionType: userNeed
    constraints:
      load:
        document:
          type: specification
      create:
        document:
          moduleFolder: Requirements
          moduleName: User Needs
          type: specification
      pick:
        document:
          moduleFolder: Requirements
    properties:
      title:
      description:
      severity:
      component:

  SystemRequirement:
    polarionType: systemRequirement
    constraints:
      create:
        document:
          moduleFolder: Requirements
          moduleName: System Requirements
          type: systemSpecification
      pick:
        document:
          component: $context.source.document.component
    properties:
      title:
      description:
      severity:

  DesignRequirement:
    polarionType: designOutput
    constraints:
      pick:
        document:
          moduleFolder: Design
          type: designSpecification
    properties:
      title:
      description:

relationships:
  - from: UserNeed
    to: SystemRequirement
    cardinality: one-to-many
    storage: linkedWorkItems
    linkRole: refines
    direct:
      name: systemRequirements
    back:
      name: userNeeds

  - from: SystemRequirement
    to: DesignRequirement
    cardinality: one-to-many
    storage: linkedWorkItems
    linkRole: refines
    direct:
      name: designRequirements
    back:
      name: systemRequirements
Domain model type names must be single words without spaces or special characters. Relationship from/to values must reference domainModelTypes names — not Polarion work item type IDs. A “left error” indicates an invalid from entity; a “right error” indicates an invalid to entity.

Related pages: Domain Model Types | Properties | Storage | Sources
KB ArticlesSupport TicketsSource Code
  • prod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/configurations/constraints_model.template.yaml
  • prod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/models/constraints-base.yaml
  • model.yaml
  • Constraints.java
  • prod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/configurations/constraints_currentDocument_downstream.template.yaml