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.
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.
| Property | Type | Description |
|---|
window.risksheet.queryFactories | object | Registry 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.
| Property | Type | Description |
|---|
window.risksheet.cellDecorators | object | Registry 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:
| Parameter | Type | Description |
|---|
info.value | varies | The current cell value |
info.cell | DOM element | The cell’s DOM element for applying CSS classes |
info.item | object | The 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.
Register custom actions for the grid right-click context menu. Custom actions appear alongside built-in menu items and can execute arbitrary JavaScript logic.
| Property | Type | Description |
|---|
window.risksheet.customContextMenuActions | array | Array of custom menu action definition objects |
Action definition properties:
| Field | Type | Required | Description |
|---|
label | string | Yes | Display text for the menu item shown to the user |
enable | string | Yes | Name of a function on the window object that returns boolean to control whether the action is enabled for the current selection |
execute | string | Yes | Name 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
| Property | Type | Default | Description |
|---|
window.risksheet.baseUrl | string | See application | Base URL for the Risksheet application, used to construct data service endpoints and navigation URLs |
window.risksheet.projectId | string | See application | Polarion project identifier for the current document, used in API endpoint construction |
window.risksheet.revision | string | "" (empty) | Document revision identifier. Empty string indicates current/head revision; non-empty forces read-only mode automatically |
window.risksheet.currentRevision | string | See application | The latest revision number of the document, used to determine if viewing current or historical version |
window.risksheet.version | string | See application | Full version string of the Risksheet application including build metadata |
window.risksheet.shortVersion | string | See application | Shortened version identifier without build metadata, suitable for display |
window.risksheet.canAdmin | boolean | false | Whether the current user has administrative privileges to modify configuration |
Configuration Data
| Property | Type | Description |
|---|
window.risksheet.appConfig | object | Full application configuration parsed from risksheet.json, including columns, data types, levels, formulas, styles, and all other settings |
window.risksheet.enums | object | Enumeration registry mapping enum IDs to arrays of enum items. Used by enum and multiEnum column types for dropdown fields. |
window.risksheet.ratings | object | Rating enumeration registry specifically for risk assessment scales (severity, occurrence, detection). Structure is identical to enums but semantically distinct. |
window.risksheet.relations | array | Array of relation definitions for cross-project or cross-document traceability mappings with field-level mappings. Used for dependent enum behavior. |
window.risksheet.refs | object | Reference enumeration registry for linked work item types or external references |
window.risksheet.document | object | Document 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:
| Property | Type | Construction | Description |
|---|
configEditUrl | string | ${baseUrl}/risksheet/configuration/ | URL to the Risksheet configuration editor interface |
documentUrl | string | ${baseUrl} + project + document path | Direct URL to the source Polarion wiki document |
dataUrl | string | Generated from template | URL 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.
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; }"
}
}
| Parameter | Type | Description |
|---|
info.item | object | The work item data for the current row, with field values accessible by column binding ID |
| Return value | varies | The 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