Skip to main content

Prerequisites

  • A domain model with entity types defined
  • Knowledge of the Polarion project IDs you want to filter by
  • A sheet configuration with at least one data source

Step 1: Add Project Constraints to Entity Types

In your domain model YAML, add a constraints section with project filtering to your entity type. The query engine uses the project.id field to scope queries:
domainModelTypes:
  SystemRequirement:
    polarionType: systemRequirement
    constraints:
      load:
        project:
          id: myProjectId
    properties:
      title:
        type: string
This ensures only SystemRequirement items from the project myProjectId are loaded into the sheet.

Step 2: Filter Across Multiple Projects

To load entities from multiple projects, provide a list of project IDs:
domainModelTypes:
  SystemRequirement:
    polarionType: systemRequirement
    constraints:
      load:
        project:
          id:
            - projectA
            - projectB
            - projectC
    properties:
      title:
        type: string
The query engine translates this into an OR clause, returning work items from any of the listed projects.
Constraint SyntaxBehavior
id: singleProjectFilters to one project
id: [projA, projB]Filters to multiple projects (OR)
No project constraintUses current project context

Step 3: Combine Project and Document Constraints

You can apply both project and document constraints for maximum precision:
domainModelTypes:
  Hazard:
    polarionType: hazard
    constraints:
      load:
        project:
          id: safetyProject
        document:
          type: riskAnalysis
    properties:
      title:
        type: string
      severity:
        type: string
When both project and document constraints are defined, they are combined with AND logic. The query engine first resolves the project filter, then applies the document filter within that scope.

Step 4: Apply Project Constraints to Relationships

Project constraints can also be applied at the relationship level to control cross-project linking. Add constraints to the relationship’s navigation property:
domainModelTypes:
  UserNeed:
    polarionType: userNeed
    properties:
      title:
        type: string

  SystemRequirement:
    polarionType: systemRequirement
    constraints:
      load:
        project:
          id: requirementsProject
    properties:
      title:
        type: string

relationships:
  - from: UserNeed
    to: SystemRequirement
    cardinality: one-to-many
    storage: linkedWorkItems
The query engine enforces entity-level security checks before executing any query. If the current user does not have read permission for an entity type in the target project, the query will return empty results without an error message.

Step 5: Use Dynamic Project Context

For picker constraints that should adapt to the current project, use $context expressions:
domainModelTypes:
  DesignRequirement:
    polarionType: designRequirement
    constraints:
      pick:
        project:
          id: $context.source.project.id
Dynamic $context expressions for project constraints are resolved at runtime. Verify the exact resolution behavior with your specific domain model configuration.

Step 6: Debug Project Filtering

If your sheet shows unexpected results, the query engine provides debug logging that shows the exact Lucene queries being executed, including the project.id filter fragments. Check the Polarion server logs for query output that includes the project scoping clause. The project filter is applied as a Lucene query fragment in the format:
project.id:"myProjectId"
For multiple projects, it produces an OR clause:
(project.id:"projectA" OR project.id:"projectB")

Verify

After configuring project constraints:
  1. Open the powersheet document in Polarion
  2. You should now see only work items from the specified project(s)
  3. Expand related entities to confirm they also respect project boundaries
  4. If using picker constraints, open a relationship dropdown and verify it only shows items from the constrained projects

See Also

Source Code
  • QueryFactory.java
  • GenericQueryResolver.java
  • PolarionQueryProcessor.java
  • DatabridgeConstants.java
  • prod-powersheet-src/com.nextedy.powersheet.client/src/modules/DocumentProvider/DocumentProvider.tsx