Risk condition evaluation info message does not show translated text of the matching Risk Condition


Description

When evaluating Risk Conditions, the info message presented to the user does not show translated text of the matching Risk Condition:

Risk Condition not translated

Steps to Reproduce

  1. Install any language Plugin: e.g. French.
  2. Change the language to French.
  3. Create a normal Change Request. Set Planned Start Date to Today and Set Planned Tomorrow.
  4. In Related Links: click "Calculate Risk". The name of the matching Risk Condition should be translated but is not.

Workaround

This problem is fixed in all currently supported releases. Review the Fixed In section to determine the latest version with a permanent fix your instance can be upgraded to.


The pre-Orlando workaround was to modify the Script Include RiskCalculator adding the following function:

	calculateRiskConditions: function() {
		var evaluatedRiskImpact = this.calculateRisk();
		if (!evaluatedRiskImpact || !evaluatedRiskImpact.riskCondition)
			return {};

		evaluatedRiskImpact.riskCondition.msg = evaluatedRiskImpact.riskCondition.msg ? evaluatedRiskImpact.riskCondition.msg += ": " + gs.getMessage("Risk Condition calculated") : gs.getMessage("Risk Condition calculated");

		if (evaluatedRiskImpact.riskCondition && evaluatedRiskImpact.riskCondition.name && evaluatedRiskImpact.riskCondition.name.value)
			evaluatedRiskImpact.riskCondition.msg += ": " + '' +
				GlideStringUtil.escapeHTML(evaluatedRiskImpact.riskCondition.name.display_value || evaluatedRiskImpact.riskCondition.name.value).replaceAll('"', '"') + "";

		evaluatedRiskImpact.riskEvaluation = {};

		if (evaluatedRiskImpact.riskCondition.risk && (evaluatedRiskImpact.riskCondition.risk.value || evaluatedRiskImpact.riskCondition.risk.value === 0) && !isNaN(evaluatedRiskImpact.riskCondition.risk.value)) {
			evaluatedRiskImpact.riskEvaluation.risk = evaluatedRiskImpact.riskCondition.risk;
			evaluatedRiskImpact.riskEvaluation.risk.updated = parseInt(evaluatedRiskImpact.riskCondition.risk.value) !== parseInt(this.changeRequestGr.risk) || this.changeRequestGr.risk.changes();
			evaluatedRiskImpact.riskCondition.msg += "; " + gs.getMessage("Risk: {0}{1}{2}", [this.getStartColorTag(), evaluatedRiskImpact.riskCondition.risk.display_value || evaluatedRiskImpact.riskCondition.risk.value, this.getEndColorTag()]);
		} else {
			// If the Risk is "Leave Alone" then populate risk with the change request risk value
			evaluatedRiskImpact.riskEvaluation.risk = {
				value: this.changeRequestGr.risk.nil() ? "" : this.changeRequestGr.risk + "",
				display_value: this.changeRequestGr.risk.getDisplayValue() + "",
				updated: false
			};
			evaluatedRiskImpact.riskCondition.msg += "; " + gs.getMessage("Risk unchanged");
		}

		// risk conditions may also set impact
		if (evaluatedRiskImpact.riskCondition.impact && evaluatedRiskImpact.riskCondition.impact.value) {
			evaluatedRiskImpact.riskEvaluation.impact = evaluatedRiskImpact.riskCondition.impact;
			evaluatedRiskImpact.riskEvaluation.impact.updated = this.changeRequestGr.impact + "" !== evaluatedRiskImpact.riskCondition.impact.value + "" || this.changeRequestGr.impact.changes();
			evaluatedRiskImpact.riskCondition.msg += "; " + gs.getMessage("Impact: {0}{1}{2}", [this.getStartColorTag(),  evaluatedRiskImpact.riskCondition.impact.display_value || evaluatedRiskImpact.riskCondition.impact.value, this.getEndColorTag()]);
		} else {
			//If the Impact is "Leave Alone" then populate impact with the change request impact value
			evaluatedRiskImpact.riskEvaluation.impact = {
				value: this.changeRequestGr.impact + "",
				display_value: this.changeRequestGr.impact.getDisplayValue() + "",
				updated: false
			};
			evaluatedRiskImpact.riskCondition.msg += "; " + gs.getMessage("Impact unchanged");
		}

		if (this._log.atLevel(global.GSLog.DEBUG))
			this._log.debug("[calculateRiskConditions] evaluatedRiskImpact: " + JSON.stringify(evaluatedRiskImpact));

		return evaluatedRiskImpact;
	},

In case Legacy Change Risk Assessment is active, also modify the Script Include RiskAssessmentCalculator from:

GlideStringUtil.escapeHTML(evaluatedRiskImpact.riskCondition.name.value).replaceAll('"', '"') + "</span></strong>";

To:

GlideStringUtil.escapeHTML(evaluatedRiskImpact.riskCondition.name.display_value || evaluatedRiskImpact.riskCondition.name.value).replaceAll('"', '"') + "</span></strong>";

 

Remove the script includes changes when upgrading to a version that has the official fix, so that they can be overwritten with the latest code.


Related Problem: PRB1353180