Skip to main content

Prerequisites

Before setting up risk matrices, ensure you have:
  • Risk work item types configured in Polarion (e.g., “risk”, “hazard”)
  • Severity and probability enumeration fields defined in your work item type
  • Administrative access to edit the risksheet.json configuration file
Risk matrices work best when your severity and probability enumerations use numeric IDs (e.g., “1”, “2”, “3”) or consistent alphanumeric codes (e.g., “S1”, “S2”, “S3”). This simplifies matrix mapping logic.

Understanding Risk Matrix Calculation

Risk matrices map combinations of severity and probability to risk levels. Two approaches are available: Direct Formula Approach: Uses conditional if-else logic to map parameter combinations to outcomes
Matrix Function Approach: Defines a mapping table that looks up risk level based on parameter values
Risk Matrix Logic Flow: Severity (S1-S4) Probability (P1-P3) Matrix Lookup Risk Level (Low/Medium/High) Visual Styling Applied

Configure Risk Matrix with Direct Formula

Add a calculated column to your columns array in risksheet.json:
{
  "id": "riskLevel",
  "header": "Risk Level",
  "type": "string",
  "level": 1,
  "readOnly": true,
  "formula": "calculateRiskLevel",
  "cellDecorator": "riskLevelColor"
}
Define the calculation logic in the formulas section:
"formulas": {
  "calculateRiskLevel": "function(info) { var sev = info.item['severity']; var prob = info.item['probability']; if (!sev || !prob) return null; if ((sev === 'S4' && prob === 'P3') || (sev === 'S4' && prob === 'P2') || (sev === 'S3' && prob === 'P3')) return 'High'; if ((sev === 'S3' && prob === 'P2') || (sev === 'S2' && prob === 'P3') || (sev === 'S4' && prob === 'P1')) return 'Medium'; return 'Low'; }"
}
Ensure your severity and probability field IDs match exactly the field IDs defined in Polarion. The formula references info.item['fieldId'] where fieldId must be the Polarion custom field ID, not the display name.

Configure Matrix Function (Advanced)

For complex matrices with many combinations, use a matrix lookup function:
"formulas": {
  "riskMatrix": "function(info) { var matrix = { 'S1': {'P1': 'Low', 'P2': 'Low', 'P3': 'Medium'}, 'S2': {'P1': 'Low', 'P2': 'Medium', 'P3': 'Medium'}, 'S3': {'P1': 'Medium', 'P2': 'Medium', 'P3': 'High'}, 'S4': {'P1': 'Medium', 'P2': 'High', 'P3': 'High'} }; var sev = info.item['severity']; var prob = info.item['probability']; if (!sev || !prob || !matrix[sev] || !matrix[sev][prob]) return null; return matrix[sev][prob]; }"
}
This approach scales better for large matrices (e.g., 5x5 or 7x7 grids) and is easier to maintain.

Add Visual Risk Indicators

Define cell decorators to apply conditional styling based on risk level:
"cellDecorators": {
  "riskLevelColor": "function(info) { var val = info.value; $(info.cell).toggleClass('risk-low', val === 'Low'); $(info.cell).toggleClass('risk-medium', val === 'Medium'); $(info.cell).toggleClass('risk-high', val === 'High'); }"
}
Define corresponding CSS styles:
"styles": {
  ".risk-low": "background-color: #eaf5e9 !important; color: #1d5f20 !important;",
  ".risk-medium": "background-color: #fff3d2 !important; color: #735602 !important;",
  ".risk-high": "background-color: #f8eae7 !important; color: #ab1c00 !important;"
}

Handle Multi-Parameter Calculations

For HARA workflows requiring harm occurrence, configure a three-parameter matrix:
"formulas": {
  "haraRisk": "function(info) { var sev = info.item['severity']; var prob = info.item['probability']; var occurrence = info.item['harmOccurrence']; if (!sev || !prob || !occurrence) return null; var combinedScore = parseInt(sev.substring(1)) * parseInt(prob.substring(1)) * parseInt(occurrence.substring(1)); if (combinedScore >= 15) return 'High'; if (combinedScore >= 8) return 'Medium'; return 'Low'; }"
}
For complex HARA or FMEA configurations, consider starting with a pre-configured template from Nextedy’s demo projects (Drive Pilot FMEA or HARA templates) and adapting the matrix logic to your specific severity/probability scales.

Verification

After saving your configuration:
  1. Open a risk document in RISKSHEET
  2. Create or edit a risk item
  3. Set severity and probability values
  4. You should see the risk level column automatically calculate and display the appropriate risk level with color coding
  5. Change severity or probability values to verify the matrix recalculates correctly
Risk matrix formulas execute client-side in the browser. Complex calculations with many nested conditions may impact performance on large risksheets (>500 rows). Test with representative data volumes.

See Also

KB ArticlesSupport TicketsSource Code
  • RisksheetProjectProperties.java
  • risksheet.json
  • PolarionAppConfigManager.java
  • AppConfig.ts
  • AppConfigParser.ts