Skip to main content

Built-In Context Menu Actions

Nextedy RISKSHEET provides these standard context menu options:
ActionAvailabilityDescription
Open Row ItemAlwaysOpens the work item for the selected row
Open Item LinkItem link columnsOpens linked work items from traceability columns
Open Task ItemTask link columnsOpens linked mitigation tasks
New Level ItemsEditable modeCreates work items at configured hierarchy levels
Overwrite Row ItemReference rowsConverts referenced items to editable overwrite mode
Remove Row ItemEditable modeDeletes the selected row
Freeze PaneAlwaysLocks columns left of selection for scrolling
Unfreeze PaneWhen frozenRemoves column freezing

Control Menu Item Visibility

Show New Level Items

To make hierarchy levels appear in the “New” submenu, set showInMenu: true in the levels configuration:
"levels": [
  {
    "name": "Risk",
    "showInMenu": true,
    "controlColumn": "systemItemId"
  },
  {
    "name": "Cause",
    "showInMenu": true,
    "controlColumn": "causeId"
  }
]

Show Task Creation

Enable task creation in the context menu via data types configuration:
"dataTypes": {
  "task": {
    "type": "task",
    "role": "mitigates",
    "name": "Mitigation",
    "showInMenu": true
  }
}

Add Custom Context Menu Actions

Extend the context menu with JavaScript-based custom actions.

Define Global Functions

In your top panel template (risksheetTopPanel.vm), register custom actions:
<script>
// Define the action function
window.exportRowToCsv = function(item, colDef) {
  const csv = `ID,Title\n${item.systemItemId},${item.title}`;
  const blob = new Blob([csv], { type: 'text/csv' });
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = `${item.systemItemId}.csv`;
  a.click();
};

// Define the enable condition
window.canExportRow = function(item, colDef) {
  return item.systemItemId && !item.systemItemId.startsWith('*');
};

// Register the custom action
window.risksheet = window.risksheet || {};
window.risksheet.customContextMenuActions = [
  {
    label: "Export Row to CSV",
    function: "exportRowToCsv",
    isEnabledFunction: "canExportRow"
  }
];
</script>

Custom Action Structure

diagram Each custom action requires:
  • label: Display text for the menu item
  • function: Global function name to execute when clicked
  • isEnabledFunction: Global function name returning boolean (whether action is enabled)
Both functions receive:
  • item: Current row’s work item data object
  • colDef: Column definition object for the clicked cell
Functions must be defined in the global window scope. They cannot access closures or module-scoped variables.
window.openRelatedDoc = function(item, colDef) {
  const docId = item.relatedDocument;
  if (docId) {
    window.open(`/polarion/#/project/${projectId}/doc/${docId}`, '_blank');
  }
};

window.hasRelatedDoc = function(item, colDef) {
  return !!item.relatedDocument;
};

window.risksheet.customContextMenuActions = [
  {
    label: "Open Related Document",
    function: "openRelatedDoc",
    isEnabledFunction: "hasRelatedDoc"
  }
];

Example: Copy Item ID

window.copyItemId = function(item, colDef) {
  navigator.clipboard.writeText(item.systemItemId).then(() => {
    toastr.success('Item ID copied to clipboard');
  });
};

window.alwaysEnabled = function(item, colDef) {
  return true;
};

window.risksheet.customContextMenuActions = [
  {
    label: "Copy Item ID",
    function: "copyItemId",
    isEnabledFunction: "alwaysEnabled"
  }
];
Use toastr.success(), toastr.error(), or toastr.warning() to provide user feedback after custom actions execute.

Debug Mode

Enable debug mode to see item and column metadata in the browser console:
  1. Add ?debug=true to the RISKSHEET URL
  2. Right-click any cell
  3. Select Debug from the context menu
  4. Open browser DevTools (F12) to see logged data

Verification

After adding custom actions:
  1. Save the top panel template with your custom JavaScript
  2. Reload the RISKSHEET page
  3. Right-click on a grid cell
  4. You should now see your custom action(s) in a separate section at the bottom of the context menu

See Also

Source Code
  • RiskSheetContextMenu.ts
  • RisksheetProjectProperties.java
  • ShowConfigurationCommand.ts
  • PolarionAppConfigManager.java
  • WorkflowActionServlet.java