Skip to main content

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:
diagram

Register Custom Context Menu Actions

Risksheet exposes an extensibility point through window.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 global window 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 the customContextMenuActions 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:
Each custom action object requires three properties:
enableFn and executeFn must be strings naming a function on window. Assigning inline function expressions (for example enableFn: function(item) { ... }) is not the supported registration form and the menu action will not appear. Define each function on window first, then reference it by name.

Step 3 — Load the Script

Place the script in your top panel configuration (risksheetTopPanel.vm) so it loads when Risksheet initializes:
Because enableFn and executeFn are resolved by name, functions defined inside closures, IIFEs, or module scopes will not be found at runtime and the menu action will silently fail. Always attach them to window.

Control New Item Menu Options

The “New [Level] Item” menu options are generated dynamically from the levels configuration in the sheet configuration. Use showInMenu to control which levels appear:
Setting 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. Set dataTypes.task.name in the sheet configuration:
With this configuration, the context menu displays “Open Mitigation Action” instead of the default “Open Task”.

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 has systemReferenceType 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:
  1. Reload the Risksheet page to load your top panel script changes.
  2. Right-click on a grid cell — you should now see your custom menu items alongside the built-in actions.
  3. Verify that the enableFn condition correctly enables and disables the action based on the selected item.
  4. 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

Last modified on July 10, 2026