Skip to main content
This page has limited source coverage. The exact API surface, method signatures, and available extension points should be verified against your specific Risksheet version. Extension points may vary between releases.
diagram

Extension Points

Query Factories

Register custom query factory functions to filter which items appear in autocomplete suggestions for item link and multi-item link columns. Query factories are named functions stored in the window.risksheet.queryFactories object and referenced by name in risksheet.json column or data type configuration.
PropertyTypeDescription
window.risksheet.queryFactoriesobjectRegistry of named query factory functions. Each key is a function name, each value is a function that returns a query string.
Function signature:
function queryFactoryName(item) {
  // item: the current row's work item data object
  // return: a Lucene query string to filter suggestions, or "" for no filter
  return "type:requirement AND project.id:MyProject";
}
Registration pattern:
// Register in a Velocity top panel template or inline script
window.risksheet = window.risksheet || {};
window.risksheet.queryFactories = window.risksheet.queryFactories || {};

window.risksheet.queryFactories["filterByProject"] = function(item) {
  return "project.id eq 'MyProject'";
};

window.risksheet.queryFactories["filterByStatus"] = function(item) {
  return "NOT status:rejected AND NOT status:obsolete";
};
Reference in risksheet.json:
{
  "dataTypes": {
    "task": {
      "queryFactory": "filterByProject"
    }
  }
}
Query factories are commonly defined in risksheetTopPanel.vm Velocity templates, where server-side document context (project ID, custom field values) can be injected into the JavaScript function body. See Top Panel Template for the pattern of bridging Velocity variables to JavaScript query factories.
If your query factory function determines that no additional filtering is needed for the current context, return an empty string "" rather than null or undefined. Empty strings are safely ignored by the query builder.

Cell Decorators

Register custom cell decorator functions for conditional visual styling of grid cells. Decorators receive cell and value information and apply or remove CSS classes to control cell appearance.
PropertyTypeDescription
window.risksheet.cellDecoratorsobjectRegistry of named cell decorator functions. Each key is a decorator name referenced from risksheet.json.
Cell decorators are typically defined directly in the cellDecorators section of risksheet.json as inline JavaScript function strings. They can also be registered on the window.risksheet.cellDecorators object from a Velocity template. Inline definition in risksheet.json:
{
  "cellDecorators": {
    "rpn": "function(info){ var val = info.value; $(info.cell).toggleClass('rpn1', val>0 && val <= 150); $(info.cell).toggleClass('rpn2', val > 150 && val <= 350); $(info.cell).toggleClass('rpn3', val > 350); }"
  }
}
Function parameters:
ParameterTypeDescription
info.valuevariesThe current cell value
info.cellDOM elementThe cell’s DOM element for applying CSS classes
info.itemobjectThe full work item data object for the current row
The complete set of properties available on the info parameter object may vary by Risksheet version. Test decorator functions in your specific environment.
See Cell Decorators and Conditional Formatting for configuration details and examples.

Custom Context Menu Actions

Register custom actions for the grid right-click context menu. Custom actions appear alongside built-in menu items and can execute arbitrary JavaScript logic.
PropertyTypeDescription
window.risksheet.customContextMenuActionsarrayArray of custom menu action definition objects
Action definition properties:
FieldTypeRequiredDescription
labelstringYesDisplay text for the menu item shown to the user
enablestringYesName of a function on the window object that returns boolean to control whether the action is enabled for the current selection
executestringYesName of a function on the window object to call when the user clicks the action
Registration pattern:
// Define the enable/execute functions on the global window object
window.canOpenExternal = function(item) {
  return item && item.systemItemId;
};

window.openInExternalTool = function(item) {
  window.open("https://tool.example.com/item/" + item.systemItemId);
};

// Register the custom context menu action
window.risksheet.customContextMenuActions = [
  {
    label: "Open in External Tool",
    enable: "canOpenExternal",
    execute: "openInExternalTool"
  }
];
The enable and execute fields reference function names as strings, not function references. The corresponding functions must be registered on the global window object. Functions defined in closures or module scopes are not accessible.

Runtime Configuration Object

The window.risksheet object provides read-only runtime configuration values set during page initialization by the server. These values reflect the current document context, version information, and user permissions.

Environment Properties

PropertyTypeDefaultDescription
window.risksheet.baseUrlstringSee applicationBase URL for the Risksheet application, used to construct data service endpoints and navigation URLs
window.risksheet.projectIdstringSee applicationPolarion project identifier for the current document, used in API endpoint construction
window.risksheet.revisionstring"" (empty)Document revision identifier. Empty string indicates current/head revision; non-empty forces read-only mode automatically
window.risksheet.currentRevisionstringSee applicationThe latest revision number of the document, used to determine if viewing current or historical version
window.risksheet.versionstringSee applicationFull version string of the Risksheet application including build metadata
window.risksheet.shortVersionstringSee applicationShortened version identifier without build metadata, suitable for display
window.risksheet.canAdminbooleanfalseWhether the current user has administrative privileges to modify configuration

Configuration Data

PropertyTypeDescription
window.risksheet.appConfigobjectFull application configuration parsed from risksheet.json, including columns, data types, levels, formulas, styles, and all other settings
window.risksheet.enumsobjectEnumeration registry mapping enum IDs to arrays of enum items. Used by enum and multiEnum column types for dropdown fields.
window.risksheet.ratingsobjectRating enumeration registry specifically for risk assessment scales (severity, occurrence, detection). Structure is identical to enums but semantically distinct.
window.risksheet.relationsarrayArray of relation definitions for cross-project or cross-document traceability mappings with field-level mappings. Used for dependent enum behavior.
window.risksheet.refsobjectReference enumeration registry for linked work item types or external references
window.risksheet.documentobjectDocument metadata object containing document properties, revision info, and configuration source information

Derived URLs

These URL properties are constructed from the environment properties and provide quick access to related Risksheet interfaces:
PropertyTypeConstructionDescription
configEditUrlstring${baseUrl}/risksheet/configuration/URL to the Risksheet configuration editor interface
documentUrlstring${baseUrl} + project + document pathDirect URL to the source Polarion wiki document
dataUrlstringGenerated from templateURL to the data service endpoint for the current project/document/revision
The exact URL construction patterns and available URL template functions depend on your Risksheet version and Polarion server configuration.

Formulas in Configuration

JavaScript formulas defined in the formulas section of risksheet.json execute in the client-side context and have access to row data through the info parameter:
{
  "formulas": {
    "rpnCalculation": "function(info){ var val = info.item['occ'] * info.item['det'] * info.item['sev']; return val ? val : null; }"
  }
}
ParameterTypeDescription
info.itemobjectThe work item data for the current row, with field values accessible by column binding ID
Return valuevariesThe computed value to display in the formula column
Formulas are referenced by name in column definitions:
{
  "columns": [
    {
      "id": "rpn",
      "header": "RPN",
      "formula": "rpnCalculation"
    }
  ]
}
See Formula Syntax, Formula Functions, and Formula Examples for comprehensive formula documentation.

See Also