Default Context Menu Actions
When you right-click a cell in the Risksheet grid, the context menu displays built-in actions depending on the cell context and grid state:Register Custom Context Menu Actions
Risksheet exposes an extensibility point throughwindow.risksheet.customContextMenuActions that allows top panel scripts to register additional menu items. The canonical registration pattern uses string function names (resolved against the global window object at runtime) for both the enable and execute hooks.
Step 1 — Define Action Functions
Create JavaScript functions on the globalwindow object. Each custom action needs an enable function (controls when the item is active) and an execute function (runs when clicked):
Step 2 — Register the Actions
Add your custom actions to thecustomContextMenuActions array. Always reference the enable and execute hooks by function name as a string — Risksheet looks the names up on window when the menu opens:
Step 3 — Load the Script
Place the script in your top panel configuration (risksheetTopPanel.vm) so it loads when Risksheet initializes:
Control New Item Menu Options
The “New [Level] Item” menu options are generated dynamically from thelevels configuration in the sheet configuration. Use showInMenu to control which levels appear:
showInMenu to false hides that level from the context menu while keeping it functional in the grid hierarchy. This is useful for levels populated automatically or through imports.
Customize Task Menu Labels
The “Open Task Item” menu label dynamically reflects the configured task type name. SetdataTypes.task.name in the sheet configuration:
Overwrite Row Item
The “Overwrite Row Item” action converts a referenced item to overwrite mode, enabling local modifications to be saved back to the source. This action appears only when the selected item hassystemReferenceType set to reference.
When Debug is available in the context menu, it logs the ghost status, column ID, cell value, full item object, and comparison manager state to the browser console — invaluable when diagnosing why an overwrite action is unavailable.Debug mode is a developer/runtime mode and is not enabled through the sheet configuration. Setting
debug: true in the global section has no effect (the key is silently ignored), and there is no appConfig.debug setting that turns it on.Triggering Polarion document workflow transitions (for example, changing document status from within Risksheet) is not provided as a built-in menu item. Use the
customContextMenuActions extensibility point to call the appropriate Polarion endpoint from your custom function.Verify Your Changes
After configuring custom context menu actions:- Reload the Risksheet page to load your top panel script changes.
- Right-click on a grid cell — you should now see your custom menu items alongside the built-in actions.
- Verify that the
enableFncondition correctly enables and disables the action based on the selected item. - Check the browser console for errors if a custom action does not appear (a common cause is a function defined inside a closure rather than on
window).
See Also
- Customize the Top Panel — add scripts and custom fields to the top panel area
- Configure Remove/Delete Actions — control how items are removed from the grid
- Understanding the Interface — overview of Risksheet UI components
- Create Custom Renderers — extend cell rendering with custom display logic