Skip to main content

Variable Summary

VariableTypeAvailabilityDescription
$itemModelObjectAll entitiesPrimary work item accessor with property access methods
$wiIWorkItemWork item entities onlyLegacy Polarion work item API for low-level operations
$txTransactionAll evaluationsCurrent transaction object for query operations
$moduleIModuleDocument-scoped entitiesDocument (LiveDoc) containing the work item; null for non-document entities
$contextPowersheetContextAll evaluationsPowersheet-specific context: project, document scope, query helpers
$pObjectIPObjectAll entitiesRaw Polarion persistent object
diagram

$item (ModelObject)

The primary accessor for work item data. Available for all entity types.
Property / MethodReturn TypeDescription
$item.titlestringWork item title
$item.statusobjectStatus object with .id property
$item.authorobjectAuthor user object
$item.createddatetimeCreation timestamp
$item.updateddatetimeLast modification timestamp
$item.uristringPolarion URI for the work item

Example

$item.title - $item.status.id
Use $item as the primary work item accessor. It provides a higher-level API than $wi and is available for all entity types.

$wi (IWorkItem)

Legacy Polarion work item API. Only available when the entity is a work item (not for documents or other entity types).
Property / MethodReturn TypeDescription
$wi.getLinkedWorkItems()collectionReturns all linked work items
$wi.getCustomField(name)objectReturns custom field value by field ID
$wi.getProjectId()stringReturns the project ID

Example

#set($links = $wi.getLinkedWorkItems())
$links.size() linked items
$wi is only set for work item entities. For Document or other non-work-item entity types, $wi is null. Use $item for cross-entity-type templates.

$tx (Transaction)

Current transaction object for transactional queries and read-only operations.
Property / MethodReturn TypeDescription
Transaction scopeobjectAccess to transaction-scoped data and queries

Example

#set($related = $trackerService.getWorkItemByUri($item.uri))
$related.title
Server-rendered templates should perform read-only operations only. Modifying data within a template evaluation can cause unexpected side effects.

$module (IModule)

The LiveDoc containing the current work item. null for entities not within a document.
Property / MethodReturn TypeDescription
$module.moduleFolderstringDocument folder/space path
$module.moduleNamestringDocument name
$module.spacestringPolarion space identifier

Example

#if($module)
  Document: $module.moduleName in $module.moduleFolder
#else
  No document context
#end
Always check #if($module) before accessing module properties. Entities that are not contained within a document will have $module set to null.

$context (PowersheetContext)

Powersheet-specific context providing access to project scope, document scope, and query capabilities.
Property / MethodReturn TypeDescription
Project contextobjectCurrent project information
Document scopeobjectCurrent document filtering context
Query helpersobjectQuery execution utilities

Example

$context.projectId
The exact methods available on $context depend on the Powersheet version. Consult the server logs for available context properties.

$pObject (IPObject)

The raw Polarion persistent object underlying the entity.
Property / MethodReturn TypeDescription
$pObject.uristringPolarion URI
$pObject.contextIdstringContext (project) identifier

Client-Side Context Variables

In addition to server-side Velocity variables, Powersheet supports client-side $context expressions for dynamic value resolution in YAML configuration.
Context PathDescription
$context.document.idCurrent document path (folder/name)
$context.parameters.modelRuntime model parameter
$context.source.document.componentSource entity’s document component
$context.source.project.idSource entity’s project ID
These are resolved at configuration processing time, not during Velocity template evaluation. See JavaScript Functions for client-side expressions.

Complete YAML Example

domainModelTypes:
  UserNeed:
    polarionType: userNeed
    properties:
      title: ~
      status: ~
      documentPath:
        serverRender: |
          #if($module)$module.moduleFolder/$module.moduleName#else(unscoped)#end
      authorName:
        serverRender: "$item.author.name"
      linkCount:
        serverRender: |
          #set($links = $wi.getLinkedWorkItems())
          $links.size()

Source context: ServerRenderer, QueryDataTest, DocumentProvider, ConfigProvider, model.yaml
Source Code
  • QueryDataTest.java
  • prod-powersheet-src/com.nextedy.powersheet.client/ltc-repo/__tests__/parseConstraints.test.ts
  • prod-powersheet-src/com.nextedy.powersheet.client/src/modules/DocumentProvider/DocumentProvider.tsx
  • prod-powersheet-src/com.nextedy.powersheet.client/src/modules/ConfigProvider/ConfigProvider.tsx
  • model.yaml