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

Cheat sheet

2612

Everything on this page was verified on Polarion 2612. Follow the links for the details.

URLs

WhatURL
Static files of an applicationhttps://<host>/polarion/apps/<identifier>/<rootDirectory>/<file>
View entry (redirects to the view's document)https://<host>/polarion/apps/<identifier>/views/<viewId>
Application endpointhttps://<host>/polarion/apps/<identifier>/rest/<urlPath>
REST APIhttps://<host>/polarion/rest/v1/…
Navigation topic pagehttps://<host>/polarion/#/project/<projectId>/<identifier>.<viewId>
Work Items table with a sidebar open…/#/project/<projectId>/workitems?sidebar=polarion-application.<identifier>.<viewId>
SDK downloadhttps://<host>/polarion/sdk/applications/polarion-app-sdk-0.5.2-preview.tgz

Configuration XML

<!-- Form layout: Project Administration → Work Items → Form Configuration → Form Layouts -->
<applicationView id="<identifier>.<viewId>" label="Panel heading" height="480px"/>

<!-- Topics: Project Administration → Portal → Topics → <View> -->
<applicationView id="<identifier>.<viewId>"/>

<!-- Sidebars: no XML; listed in Show Sidebar automatically -->

Package layout

  • <identifier>.zip
    • <identifier>/ one top-level folder, named after the identifier
      • manifest.json
      • <rootDirectory>/ per view, or shared by several views: index.html + assets (relative URLs)
      • server-scripts/ only with serverScripts.endpoints

Server settings

# Global Administration → Configuration Properties (global configuration property)
polarionapp.enabled=true                                      # Applications feature

# polarion.properties (restart required)
com.siemens.polarion.rest.enabled=true                        # REST API (else 503)
com.siemens.polarion.rest.security.restApiToken.enabled=true  # token for views (else warning dialog, 401)

SDK

import { fetchContext, events, EventTypes, destroy } from 'polarion-app-sdk';
const context = await fetchContext();                       // 5 s timeout outside Polarion
const stop = events.subscribe(EventTypes.SELECTION_CHANGED, ({ selectedWorkItemIds }) => {});
stop(); destroy();                                          // on unmount

context.restBaseUrl and context.appEndpoint have no trailing slash. workItemId is project-local (DP-477); selectedWorkItemIds and selection events carry the project (drivepilot/DP-477).

REST call

fetch(`${context.restBaseUrl}/projects/${p}/workitems/${id}?fields[workitems]=id,title,status`, {
  headers: { 'X-Polarion-REST-Token': context.restToken!, Accept: 'application/json' },
});

Sparse field sets also filter relationships: fields[linkedworkitems]=role,suspect,workItem.

Endpoint rules

  1. Every call carries objectId (PROJECT/WI-ID), in the query string (GET) or the body (POST).
  2. POST bodies are flat objects with string values; encode lists as JSON strings.
  3. arguments.getAsString('x') throws for an absent parameter; guard optional ones.
  4. Inside a function, arguments is JavaScript's own; capture const scriptArguments = arguments; at the top.
  5. Save what you change: wi.save() for fields, comment.save() for a new comment.
  6. The last expression is the response; an error key makes it an error (HTTP 400 with the envelope).
const trackerService = context.scriptContext().services().tracker();
const scriptArguments = arguments;
let result = {};
try {
  const [projectId, wiId] = scriptArguments.getAsString('objectId').split('/');
  const wi = trackerService.getWorkItem(projectId, wiId);
  result = { id: wi.getId(), title: wi.getTitle() };
} catch (e) {
  result = { error: 'my-endpoint failed: ' + e };
}
result;

Upload dialog

Install: identity + SHA-2 hash (128 hex digits). Update: New Version next to Current Version. Delete: immediate, no visible confirmation.