Skip to main content
Use the typeProperties.itemTemplate configuration when you need to:
  • Display additional properties alongside the linked item (e.g., severity rating with an effect link)
  • Format multi-item link columns with custom HTML structure
  • Show linked item descriptions or other fields inline with the link
  • Create custom visual layouts for linked items that standard sub-columns cannot achieve
This technique is especially valuable for multiItemLink columns, which do not support traditional sub-columns using dot notation. Custom rendering lets you display linked item properties that would otherwise require separate columns.

Configure Custom Item Templates

Add the itemTemplate property to your column’s typeProperties section. The template uses Velocity syntax to access linked item fields:
{
  "headerGroup": "Potential risks",
  "headerGroupCss": "headPotentialRisks",
  "headerCss": "headPotentialRisks",
  "header": "Effects",
  "type": "multiItemLink",
  "width": 200,
  "filterable": true,
  "level": 2,
  "id": "effects",
  "canCreate": true,
  "typeProperties": {
    "linkRole": "effect",
    "linkTypes": "risk",
    "createInCurrentDocument": true,
    "itemTemplate": "<span style=\"display: table-cell;width:100%;padding-right:4px;\">$item.fields().description().render().htmlFor().forFrame() </span><span style=\"display: table-cell;white-space: nowrap;\">[S:$item.fields().get(\"severityRating\").render().withIcon(false).htmlFor().forFrame()]"
  }
}

Understanding the Template Syntax

The itemTemplate uses Velocity script to render linked item content: diagram

Key Template Elements

  • $item — The current linked work item
  • .fields() — Access to all Polarion fields
  • .get("fieldId") — Access specific custom field by ID
  • .render() — Converts field value to displayable format
  • .htmlFor().forFrame() — Renders as HTML suitable for RISKSHEET display
  • .withIcon(false) — Suppress field type icons

Common Template Patterns

Display Item ID and Title

"itemTemplate": "$item.render().withTitle().withIcon(false).withLinks().htmlFor().forFrame()"

Show Description with Severity Badge

"itemTemplate": "<span style=\"display:block;\">$item.fields().description().render().htmlFor().forFrame()</span><span style=\"font-size:0.9em;color:#666;\">[Sev: $item.fields().severity().render().htmlFor().forFrame()]</span>"

Multi-Column Layout with Table Cells

"itemTemplate": "<span style=\"display:table-cell;width:70%;\">$item.fields().title().render().htmlFor().forFrame()</span><span style=\"display:table-cell;width:30%;text-align:right;\">$item.fields().status().render().htmlFor().forFrame()</span>"
When adding HTML to itemTemplate, you must escape double quotes with backslashes (\") because the template is a JSON string value. Failure to escape quotes will break the JSON configuration.

Styling Custom Templates

Use inline CSS within the template for custom styling:
  • display: table-cell — Create side-by-side layout
  • white-space: nowrap — Prevent text wrapping
  • padding-right: 4px — Add spacing between elements
  • color: #666 — Apply text color
  • font-size: 0.9em — Adjust text size
For consistent styling across multiple columns, consider defining CSS classes in the styles section of risksheet.json and referencing them in your template with class attributes.

Alternative: Server Render for Sub-Columns

If you need to display linked item properties in separate columns rather than inline with the link, use serverRender instead:
{
  "header": "Severity",
  "width": 100,
  "serverRender": "<ol style='margin-block-start: -16px;'>#foreach($linkedItem in $item.fields().linkedWorkItems()) #set($wi = $linkedItem.fields().workItem().get()) <li>$wi.fields().severity().render().withIcon(true).htmlFor().forFrame()</li> #end</ol>"
}
See Render Custom Data for detailed serverRender guidance.

Verification

After configuring custom link rendering:
  1. Save your risksheet.json configuration
  2. Refresh the RISKSHEET widget
  3. You should now see linked items displayed with your custom format, showing additional properties alongside the link text
  4. For multiItemLink columns, each linked item should display with the custom template applied

See Also

KB ArticlesSupport TicketsSource Code
  • CellPreviewFormatter.ts
  • ExportToExcel.ts
  • MultiItemLinkEditor.ts
  • RiskSheetContextMenu.ts
  • ExportToPdf.ts