The chat responses are generated using Generative AI technology for intuitive search and may not be entirely accurate. They are not intended as professional advice. For full details, including our use rights, privacy practices and potential export control restrictions, please refer to our Generative AI Service Privacy Information. As this is a test version, please let us know if something irritating comes up. Like you get recommended a chocolate fudge ice cream instead of an energy managing application. If that occurs, please use the feedback button in our contact form!
Skip to content

Form extension

2612

A form extension is a panel inside the Work Item form. Polarion renders it as a collapsible section with a heading, like Description or Comments, and loads your view in an iframe inside it.

Form extension panel in a Work Package of the Drive Pilot demo project

Declare the view

manifest.json (excerpt)
"views": {
  "formExtensions": [
    {
      "identifier": "card",
      "title": "Work item card",
      "rootDirectory": "card",
      "document": "index.html"
    }
  ]
}

title appears to be informational in 2612; the panel heading comes from the label attribute in the form layout.

Place it in a form layout

Form layouts are configured per project, per work item type, and per Polarion View (hat; most projects only use Default).

  1. Open the project and go to Administration → Work Items → Form Configuration.
  2. Scroll to Form Layouts. Click Edit for the work item type, or Create New Form Layout if the type has none yet (then choose the View and type).
  3. Insert the element where the panel should appear and click Save.
Form layout
<?xml version="1.0" encoding="UTF-8"?>
<formLayout xmlns="http://polarion.com/schema/WorkItems/FormLayout" …>
  <horizontal>
    <vertical>
      <section>…</section>
    </vertical>
  </horizontal>
  <field id="description"/>
  <applicationView id="com.example.workitemcard.card" label="Work item card" height="640px"/>
  <field id="comments"/>
  <field id="linkedWorkItems"/>
</formLayout>

The form layout editor

Attributes

AttributeRequiredMeaning
idyes<application identifier>.<view identifier>
labelnoHeading of the panel. Default: Polarion Application.
heightnoCSS height of the iframe, for example 320px. Default: 600px. The iframe does not grow with its content; size it for your view or make the view scroll internally.

applicationView is a top-level element of the layout, a sibling of <field>, <horizontal> and <extension>. It cannot be placed inside <section> or <panel>.

The same view can be referenced in several layouts (several types, several projects). Each occurrence gets its own iframe.

Where the panel shows up

The form layout applies to every place that renders the Work Item form: the editor below the Work Items table, the full-page work item view and, as far as the layout is shared, the work item editor opened from a Document. Your view is loaded in each of them.

Context in a form extension

{
  "applicationId": "com.example.workitemcard",
  "viewId": "card",
  "projectId": "test",
  "workItemId": "TEST-514",
  "selectedWorkItemIds": ["test/TEST-514"],
  "appEndpoint": "…/polarion/apps/com.example.workitemcard/rest",
  "restBaseUrl": "…/polarion/rest/v1",
  "restToken": "…"
}

When the form is opened from a Document, spaceId and documentId are also set. In the multi-item edit form below the Work Items table, opened by ticking several rows, a form extension gets all ticked items in selectedWorkItemIds (for example ["drivepilot/DP-477", "drivepilot/DP-461", "drivepilot/DP-393"]), while workItemId is the current item (DP-477). Observed on Polarion 2612.

Creating a new work item

In the create form (a work item that is not saved yet) there is no workItemId. Handle the missing field by rendering a short hint; most panels have nothing useful to show before the item exists.

Design notes

  • The panel inherits nothing from Polarion's styles. Use a system font stack and neutral colors so that it looks native; the examples' styles.css is a starting point.
  • The form is often shown in a narrow column next to a table. Make the view responsive down to about 600 px.
  • Lazy-load heavy data. The panel renders together with the rest of the form; a slow first request delays nothing but looks sluggish.
  • The iframe is destroyed when the user opens another work item. Do not rely on in-memory state across items.

Removing

Delete the applicationView element from the layout and save. Deleting the application without editing the layout also removes the panel, but leaves a dangling reference in the configuration.