Change Risk Assessments that no longer match and a different assessment matches allows evaluation of risk without completion of the other risk assessmentDescriptionChange Risk Assessments that no longer match and and have a different assessment matching, but not yet completed, allows evaluation of risk without completion of the newly matching risk assessment.Steps to Reproduce 1. Install Change Risk Assessment plugin2. Modify Change Risk Assessment so that it runs when On Hold is false.3. Create a copy of Change Risk Assessment so that it runs when On Hold is true.4. Create a change request and complete a change risk assement.5. Set On Hold to true.6. Click "Calculate Risk" Expected:Message: "Complete Risk Assessment to calculate risk" Actual:Risk is evaluatedWorkaroundModify script include: RiskCalculator sysId: 454fe086c0a8ce0100586a71d9aaaefa as follows: var RiskCalculator = Class.create(); RiskCalculator.prototype = Object.extendsObject(RiskCalculatorSNC, { evaluateRiskImpact: function() { var evaluatedRiskImpact = {}; // Risk Assessment plugin active if (GlidePluginManager.isActive(RiskCalculatorSNC.CHG_RISK_ASMT_PLUGIN)) { var changeRiskAsmt = new global.ChangeRiskAsmt(this.changeRequestGr, this._originalChangeRequestGr, this.changeRiskDetailsGr); changeRiskAsmt.setHideNotification(this.hideNotification); if (changeRiskAsmt.hasAssessment() && !changeRiskAsmt.hasCompletedMatchingAssessment()) evaluatedRiskImpact.errorMsg = gs.getMessage("Complete Risk Assessment to calculate risk"); else evaluatedRiskImpact = this._dryRun ? changeRiskAsmt.setChangeRiskImpact() : changeRiskAsmt.updateChangeRiskImpact(); } else { // Legacy Risk Assessment plugin active if (GlidePluginManager.isActive(RiskCalculatorSNC.LEGACY_CHG_RISK_ASMT_PLUGIN)) evaluatedRiskImpact = this._dryRun ? this.legacySetChangeRiskImpact() : this.legacyUpdateChangeRiskImpact(); else evaluatedRiskImpact = this._dryRun ? this.setChangeRiskImpact() : this.updateChangeRiskImpact(); } if (this._log.atLevel(global.GSLog.DEBUG)) this._log.debug("[evaluateRiskImpact] dryRun: " + this._dryRun + " evaluatedRiskImpact: " + JSON.stringify(evaluatedRiskImpact)); evaluatedRiskImpact = this._removeLegacyValues(evaluatedRiskImpact); if (!evaluatedRiskImpact.errorMsg) this._showInfoMessage(evaluatedRiskImpact); return evaluatedRiskImpact; }, type: 'RiskCalculator' }); Modify script include: ChangeRiskAsmt sysId: 884c5254d7233200532c24837e61032c as follows: var ChangeRiskAsmt = Class.create(); ChangeRiskAsmt.prototype = Object.extendsObject(ChangeRiskAsmtSNC, { hasCompletedAssessment: function(changeRequestGr, changeRiskAsmtSysIds) { changeRequestGr = changeRequestGr || this.changeRequestGr; if (!changeRequestGr) return false; var hasCompleteAsmt = this._getAsmtInstancesByTaskId(changeRequestGr.getUniqueValue(), this.COMPLETE, changeRiskAsmtSysIds).length > 0; if (this._log.atLevel(global.GSLog.DEBUG)) this._log.debug("[hasCompletedAssessment] hasCompleteAsmt: " + hasCompleteAsmt); return hasCompleteAsmt; }, hasCompletedMatchingAssessment: function(changeRequestGr) { changeRequestGr = changeRequestGr || this.changeRequestGr; return this.hasCompletedAssessment(changeRequestGr, this._getMatchingRiskAsmts(changeRequestGr)); }, _getAsmtInstancesByTaskId: function(taskId, state, matchingAsmtSysIds) { state = this._isAsmtComplete(state) ? this.COMPLETE : this._getAsmtState(state); if (this._log.atLevel(global.GSLog.DEBUG)) this._log.debug("[_getAsmtInstancesByTaskId] taskId: " + taskId + " state: " + state); if (!taskId) return []; var asmtInstances = []; var gr = new GlideRecord(this.ASMT_INSTANCE); gr.addQuery("task_id", taskId); if (Array.isArray(matchingAsmtSysIds)) gr.addQuery("metric_type", "IN", matchingAsmtSysIds); if (state === this.COMPLETE) gr.addQuery("state", this.COMPLETE); else gr.addQuery("state", this.NOT, this.COMPLETE); // incomplete or cancelled gr.addQuery("metric_type.sys_class_name", this.CHANGE_RISK_ASMT); gr.orderByDesc("sys_created_on"); gr.query(); if (this._log.atLevel(global.GSLog.DEBUG)) this._log.debug("[_getAsmtInstancesByTaskId] encodedQuery: " + gr.getEncodedQuery()); while (gr.next()) asmtInstances.push(gr.getUniqueValue()); if (this._log.atLevel(global.GSLog.DEBUG)) this._log.debug("[_getAsmtInstancesByTaskId] " + state + " assessment instances: " + asmtInstances.length + "" + JSON.stringify(asmtInstances)); return asmtInstances; }, type: 'ChangeRiskAsmt' });Related Problem: PRB1810280