> ## 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.

# Server Rendering Guides

> Nextedy POWERSHEET provides a server-side rendering engine that evaluates Velocity templates to produce computed property values at query time.

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>;
};

<Columns cols={3}>
  <Card title="Create a Computed Property" icon="file" href="/powersheet/guides/server-rendering/create-computed-property">
    Add a server-rendered property to your data model that computes its value dynamically from work item data, related entities, or platform services.
  </Card>

  <Card title="Use Velocity Templates" icon="code" href="/powersheet/guides/server-rendering/use-velocity-template">
    Write Velocity template expressions that access work item fields, document context, and the full set of context variables available during rendering.
  </Card>

  <Card title="Access Polarion Services" icon="file" href="/powersheet/guides/server-rendering/access-polarion-services">
    Call Polarion platform services such as `$trackerService`, `$repositoryService`, and `$securityService` from within your Velocity templates for advanced queries and permission checks.
  </Card>

  <Card title="Debug Template Errors" icon="file" href="/powersheet/guides/server-rendering/debug-template-errors">
    Diagnose and resolve common rendering failures including parse errors, missing variables, method invocation exceptions, and the `#SERVER_RENDER_ERROR` marker.
  </Card>
</Columns>

## How Server Rendering Works

The following diagram shows how a server-rendered property flows from configuration to display.

```
 Data Model YAML              Server API                  Sheet
 +-----------------------+      +---------------------+     +------------------+
 | entity: Hazard        |      | 1. Parse YAML       |     |                  |
 | properties:           | ---> | 2. Detect            | --> | Rendered value   |
 |   riskLevel:          |      |    serverRender      |     | shown in cell    |
 |     serverRender: ... |      | 3. Build Velocity    |     |                  |
 +-----------------------+      |    context ($item,   |     +------------------+
                                |    $wi, $module,     |
                                |    $context, $tx)    |
                                | 4. Evaluate template |
                                | 5. Return result     |
                                +---------------------+
```

When a property includes a `serverRender` definition, the server API evaluates the Velocity template for each entity row. The template receives a pre-populated context containing the current work item, document, transaction, and injected Polarion services. The evaluated result is returned as the property value and displayed in the sheet column.

<Tip title="When to use server rendering">
  Server-rendered properties are best suited for values that cannot be expressed as a simple field binding:

  * **Cross-entity lookups** -- aggregate or reference data from linked work items
  * **Conditional formatting** -- compute display strings based on multiple field values
  * **Platform queries** -- run Lucene queries via `$trackerService` to count or filter related items
  * **Permission-aware values** -- use `$securityService` to vary output by user role

  For straightforward field display or client-side calculations, use standard column bindings or the `formula` expression in your [sheet configuration](/powersheet/guides/sheet-configuration/index) instead.
</Tip>

| Context Variable     | Type               | Description                                                       |
| -------------------- | ------------------ | ----------------------------------------------------------------- |
| `$item`              | ModelObject        | Current work item with access to all properties                   |
| `$wi`                | IWorkItem          | Low-level Polarion work item API (work items only)                |
| `$module`            | IModule            | Current LiveDoc document context (null for non-document entities) |
| `$context`           | IDatabridgeContext | Server API context with project and query capabilities            |
| `$tx`                | Transaction        | Current transaction for scoped read operations                    |
| `$trackerService`    | ITrackerService    | Query work items, run Lucene searches, access tracker metadata    |
| `$repositoryService` | IRepositoryService | Access project metadata, users, and repository configuration      |
| `$securityService`   | ISecurityService   | Check permissions and enforce role-based visibility               |

## Related Resources

* **[Server Rendering Reference](/powersheet/reference/server-rendering/index)** -- complete property and context variable reference
* **[Use Velocity Templates](/powersheet/guides/server-rendering/use-velocity-template)** -- step-by-step guide to writing your first template
* **[Configure Dynamic Expressions](/powersheet/guides/sheet-configuration/configure-dynamic-expressions)** -- client-side `() =>` expressions as an alternative to server rendering

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