Skip to main content

Server Rendering Context

When a property is configured with serverRender, the server evaluates the expression using Velocity templates with automatically injected Polarion services. These services are available as context variables in all server-rendered expressions.

Injected Polarion Services

Service VariablePurposeCommon Use Cases
$trackerServiceAccess work item dataQuerying work items, running Lucene queries, accessing tracker metadata
$txServiceTransaction managementUnderstanding execution context, managing Polarion transactions
$repositoryServiceRepository-level operationsAccessing project metadata, users, roles, repository configuration
$securityServicePermission checkingChecking user permissions, role-based visibility, enforcing security constraints
These services are automatically available in every server-rendered expression. No additional configuration is required to access them.

Server-Rendered Property Configuration

Properties configured with serverRender in the domain model are evaluated on the server before being sent to the client. This affects both how the property value is computed and its editability.

Property Definition

NameTypeDefaultDescription
namestringRequiredProperty name exposed in the Powersheet client
serverNamestringSame as nameOverride for the actual Polarion field name when it differs from the client-facing name
customFieldNamestringnullPolarion custom field ID for properties stored in custom fields
typestringSee applicationData type of the property (string, integer, date, enum, etc.)
storagestringSee applicationHow the property value is persisted in Polarion
readablebooleantrueControls whether the property can be read by clients
updatablebooleantrueControls whether the property can be modified by clients
scalarbooleantrueWhether property holds a single value (true) or collection (false)
Properties with serverRender enabled are automatically marked as non-editable in the sheet, regardless of the updatable setting. The server computes the value on each query; client-side edits would be overwritten.

Velocity Template Context Variables

Server-rendered expressions have access to these context variables during template execution:
VariableDescription
$itemThe current work item being rendered
$txThe current transaction context
$contextThe query context including project, document, and parameters
$pObjectThe Polarion persistent object reference
diagram

Service Usage Patterns

Tracker Service

Use $trackerService to query work items, access tracker metadata, and run Lucene queries within server-rendered expressions.
$trackerService.queryWorkItems("project.id:myProject AND type:requirement", "id")

Security Service

Use $securityService to implement role-based visibility and conditional content in server-rendered fields.
#if($securityService.canPerformActionOnWorkItem($item, "modify"))
  editable
#else
  read-only
#end

Repository Service

Use $repositoryService to access project metadata, user information, and repository configuration.
$repositoryService.getProjectByID("myProject").getName()

Security Considerations

Server-rendered properties interact with the Powersheet security model:
AspectBehavior
EditabilityServer-rendered fields are always read-only in the client
Permission inheritanceEntity-level readable/updatable settings intersect with property-level settings
System read-only fieldsid, outlineNumber are always read-only regardless of configuration
The exact list of available service methods depends on the Polarion server version. Consult the Polarion SDK documentation for the full API reference of each injected service.

Complete YAML Example

domainModelTypes:
  UserNeed:
    polarionType: userNeed
    properties:
      title: ~
      severity: ~
      computedStatus:
        serverRender: |
          #set($linkedItems = $trackerService.queryWorkItems(
            "project.id:$item.projectId AND type:systemRequirement", "id"))
          #if($linkedItems.size() > 0)
            Linked
          #else
            Unlinked
          #end
        readable: true
        updatable: false
  SystemRequirement:
    polarionType: systemRequirement
    properties:
      title: ~
      priority: ~
Source Code
  • Property.java
  • prod-powersheet-src/com.nextedy.powersheet.client/ltc-repo/packages/common/types/domain/document.ts
  • ServerRendererTest.java
  • web.xml
  • DataPropertyFactory.java