> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nextedy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Access Polarion Services

> Use Siemens Polarion ALM platform services within Nextedy POWERSHEET server-rendered expressions to query work items, check permissions, and access repository metadata.

export const LastReviewed = ({date}) => {
  if (!date) return null;
  const formatted = new Date(`${date}T00:00:00Z`).toLocaleDateString("en-US", {
    year: "numeric",
    month: "long",
    day: "numeric",
    timeZone: "UTC"
  });
  return <p className="mt-10 text-sm text-gray-400 dark:text-zinc-500 not-prose">
      Last reviewed on {formatted}
    </p>;
};

## Prerequisites

* A data model with at least one server-rendered property (see [Create a Computed Property](/powersheet/guides/server-rendering/create-computed-property))
* Familiarity with [Velocity template syntax](/powersheet/guides/server-rendering/use-velocity-template)

## Available Platform Services

Powersheet automatically injects the following Polarion services into every server-rendered template evaluation context:

| Variable             | Service             | Purpose                                                   |
| -------------------- | ------------------- | --------------------------------------------------------- |
| `$trackerService`    | ITrackerService     | Query work items, access project tracker metadata         |
| `$txService`         | ITransactionService | Transaction management and context                        |
| `$repositoryService` | IRepositoryService  | Project metadata, users, roles, configuration             |
| `$securityService`   | ISecurityService    | Permission checks, user authentication, role-based access |

<Frame>
  <img src="https://mintcdn.com/none-17b4493f/-WiVljKlDztH36bB/powersheet/diagrams/guides/server-rendering/access-polarion-services/diagram-1.svg?fit=max&auto=format&n=-WiVljKlDztH36bB&q=85&s=bed0bbb8f1f952b7c42103cd9de580d0" alt="diagram" style={{ width: "520px", maxWidth: "100%" }} width="520" height="190" data-path="powersheet/diagrams/guides/server-rendering/access-polarion-services/diagram-1.svg" />
</Frame>

<Steps>
  <Step title="Use $trackerService to Query Work Items">
    The `$trackerService` provides access to Polarion's tracker for querying work items and project data:

    ```yaml theme={null}
    properties:
      parentProject:
        serverRender: "$trackerService.getProjectById($item.projectId).getName()"
        readable: true
        updatable: false
    ```

    <Warning title="Performance consideration">
      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.
    </Warning>
  </Step>

  <Step title="Use $repositoryService for Repository Metadata">
    The `$repositoryService` provides access to project-level metadata, users, and roles:

    ```yaml theme={null}
    properties:
      authorName:
        serverRender: "#if($item.author)$repositoryService.getUser($item.author).getName()#else Unknown#end"
        readable: true
        updatable: false
    ```

    <Tip title="Cache-friendly patterns">
      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.
    </Tip>
  </Step>

  <Step title="Use $securityService for Permission Checks">
    The `$securityService` enables role-based visibility and permission-aware computed values:

    ```yaml theme={null}
    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>

  <Step title="Use $tx for Transaction Context">
    The `$tx` variable provides access to the current transaction, useful for read-only operations that need transactional consistency:

    ```yaml theme={null}
    properties:
      txInfo:
        serverRender: "#if($tx)In transaction#else No transaction#end"
        readable: true
        updatable: false
    ```

    <Info title="Verify in application">
      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.
    </Info>
  </Step>

  <Step title="Combine Multiple Services">
    For complex computed properties, combine several services in a single template:

    ```yaml theme={null}
    properties:
      auditField:
        serverRender: "#set($user = $repositoryService.getUser($item.author))#set($project = $trackerService.getProjectById($item.projectId))$user.getName() @ $project.getName()"
        readable: true
        updatable: false
    ```
  </Step>

  <Step title="Handle Service Errors">
    If a service call fails, the template engine returns `#SERVER_RENDER_ERROR`. Protect against common failures:

    ```yaml theme={null}
    properties:
      safeProject:
        serverRender: "#set($proj = $trackerService.getProjectById($item.projectId))#if($proj)$proj.getName()#else Unknown Project#end"
        readable: true
        updatable: false
    ```

    <Warning title="Error marker in cells">
      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.
    </Warning>
  </Step>
</Steps>

## 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](/powersheet/guides/server-rendering/debug-template-errors) guide

## See Also

* [Create a Computed Property](/powersheet/guides/server-rendering/create-computed-property) -- defining server-rendered properties
* [Use Velocity Templates](/powersheet/guides/server-rendering/use-velocity-template) -- template syntax and patterns
* [Debug Template Errors](/powersheet/guides/server-rendering/debug-template-errors) -- troubleshooting rendering failures
* [Set Entity Permissions](/powersheet/guides/data-model/set-permissions) -- entity-level access control

<LastReviewed date="2026-07-02" />
