Skip to main content

Prerequisites

Available Platform Services

Powersheet automatically injects the following Polarion services into every server-rendered template evaluation context:
VariableServicePurpose
$trackerServiceITrackerServiceQuery work items, access project tracker metadata
$txServiceITransactionServiceTransaction management and context
$repositoryServiceIRepositoryServiceProject metadata, users, roles, configuration
$securityServiceISecurityServicePermission checks, user authentication, role-based access
diagram

Step 1: Use $trackerService to Query Work Items

The $trackerService provides access to Polarion’s tracker for querying work items and project data:
properties:
  parentProject:
    serverRender: "$trackerService.getProjectById($item.projectId).getName()"
    readable: true
    updatable: false
Each call to $trackerService methods executes against the Polarion database. Avoid expensive queries like getDataService().searchInstances() in templates that render for every row in a large sheet.

Step 2: Use $repositoryService for Repository Metadata

The $repositoryService provides access to project-level metadata, users, and roles:
properties:
  authorName:
    serverRender: "#if($item.author)$repositoryService.getUser($item.author).getName()#else Unknown#end"
    readable: true
    updatable: false
The service context is cached across all template evaluations within a single query. Methods that return static data (project names, user names) are efficient to call repeatedly.

Step 3: Use $securityService for Permission Checks

The $securityService enables role-based visibility and permission-aware computed values:
properties:
  accessLevel:
    serverRender: "#if($securityService.canReadInstance($wi))Full Access#else Restricted#end"
    readable: true
    updatable: false
Use cases for $securityService:
  • Show or hide sensitive data based on user role
  • Display different labels depending on write permissions
  • Create audit-friendly computed fields showing access status

Step 4: Use $tx for Transaction Context

The $tx variable provides access to the current transaction, useful for read-only operations that need transactional consistency:
properties:
  txInfo:
    serverRender: "#if($tx)In transaction#else No transaction#end"
    readable: true
    updatable: false
The exact methods available on each service depend on your Polarion version and API. Consult your Polarion SDK documentation for the complete method reference of ITrackerService, IRepositoryService, ISecurityService, and ITransactionService.

Step 5: Combine Multiple Services

For complex computed properties, combine several services in a single template:
properties:
  auditField:
    serverRender: "#set($user = $repositoryService.getUser($item.author))#set($project = $trackerService.getProjectById($item.projectId))$user.getName() @ $project.getName()"
    readable: true
    updatable: false

Step 6: Handle Service Errors

If a service call fails, the template engine returns #SERVER_RENDER_ERROR. Protect against common failures:
properties:
  safeProject:
    serverRender: "#set($proj = $trackerService.getProjectById($item.projectId))#if($proj)$proj.getName()#else Unknown Project#end"
    readable: true
    updatable: false
If you see #SERVER_RENDER_ERROR in the sheet, the Velocity template failed. Check the Polarion server logs for the specific exception — common causes include null pointer access, invalid method calls, or missing resources.

Verify

After adding service-based computed properties:
  1. Open the powersheet document in Polarion
  2. You should now see computed values populated from platform services
  3. Test with different user accounts to verify permission-aware fields display correctly
  4. If any cells show #SERVER_RENDER_ERROR, consult the Debug Template Errors guide

See Also

Source Code
  • prod-powersheet-src/com.nextedy.powersheet.client/src/modules/DocumentProvider/DocumentProvider.tsx
  • ServerRendererTest.java
  • prod-powersheet-src/com.nextedy.powersheet.client/cypress/e2e/admin/admin.cy.ts
  • prod-powersheet-src/com.nextedy.powersheet/src/com/nextedy/powersheet/PowersheetService.java
  • web.xml