Double clicking Risk Assessment and completing the Change Risk Assessment does not close the modal dialogDescriptionDouble clicking Risk Assessment and completing the Change Risk Assessment does not close the modal dialog. Instead it leaves the modal dialog open sometimes showing a different page and also preventing Risk Evaluation and update of Change request formSteps to Reproduce Install the Change Risk Assessment PluginCreate a Normal or Emergency ChangeDouble click: Risk AssessmentFill out the Change Risk Assessment and submit Expected: Modal Dialog closes and Risk is evaluatedActual: Modal Dialog does not close and Risk is not evaluated WorkaroundModify UI Action: Risk Assessment sysId: 8d300156d7033200532c24837e6103e8 //# sourceURL=RiskAssessmentV2.js var clicked = false; function invokeAssessment() { if (!clicked) { clicked = true; new ChangeRiskUiActionControl().invokeAssessment(); } } var ChangeRiskUiActionControl = Class.create({ initialize: function() { }, invokeAssessment: function() { delete window.g_parentDialog; g_form.hideAllFieldMsgs(); if (!g_form.submitted && g_form.modified) this.handleDirtyForm(); else { var changeRequestSysId = g_form.getUniqueValue(); var tableName = g_form.getTableName(); var ga = new GlideAjax("ChangeRiskAsmtAjax"); ga.addParam("sysparm_name", "invokeAssessmentAjax"); ga.addParam("sysparm_id", changeRequestSysId); ga.addParam("sysparm_class", tableName); ga.getXMLAnswer(this.processAsmt.bind(this)); } }, deleteAsmt: function(asmtInstanceSysId) { if (window.NOW.change_managment.riskAsmtAction === "delete") { var ga = new GlideAjax("ChangeRiskAsmtAjax"); ga.addParam("sysparm_name", "deleteAsmtInstanceAjax"); ga.addParam("sysparm_id", asmtInstanceSysId); ga.getXMLAnswer(function(answer){ }); } else if (window.NOW.change_managment.riskAsmtAction === "reload") window.location.reload(); }, processAsmt: function(answer) { answer = JSON.parse(answer); if (!answer.hasAsmt) g_form.addInfoMessage(getMessage("There are no risk assessments defined for this Change Request")); else { if (answer.asmtComplete) this.handleCompletedAsmt(); else { var asmtInstanceSysId = answer.asmtInstanceSysId; var changeRiskAsmtSysId = answer.changeRiskAsmtSysId; var changeRequestSysId = answer.changeRequestSysId; var riskAsmtName = answer.riskAsmtName; this.handleAsmt(asmtInstanceSysId, changeRiskAsmtSysId, changeRequestSysId, riskAsmtName); } } }, handleDirtyForm: function() { var dirtyFormUiPage = "change_risk_asmt_dirty_form_dialog"; var dialogWindow = new GlideModal(dirtyFormUiPage, false, "modal-md"); dialogWindow.setTitle(getMessage("Save changes")); dialogWindow.setPreference("displayValue", g_form.getDisplayValue()); dialogWindow.setPreference("focusTrap", true); dialogWindow.render(); window.g_parentDialog = dialogWindow; clicked = false; }, handleCompletedAsmt: function() { var displayValue = g_form.getDisplayValue(); var completedAsmtUiPage = "change_risk_completed_asmt_dialog"; var dialogWindow = new GlideModal(completedAsmtUiPage, false, "modal-md"); dialogWindow.setTitle(getMessage("Risk Assessment Complete")); dialogWindow.setPreference("displayValue", displayValue); dialogWindow.setPreference("focusTrap", true); dialogWindow.render(); window.g_parentDialog = dialogWindow; clicked = false; }, getEncodedUrl: function(changeRequestSysId, asmtInstanceSysId) { var closeUiPage = "change_risk_asmt_close_dialog"; var url = "/" + closeUiPage + ".do"; url += "?sysparm_stack=no"; url += "&sysparm_id=" + changeRequestSysId; url += "&sysparm_asmtInstanceSysId=" + asmtInstanceSysId; return encodeURIComponent(url); }, handleAsmt: function(asmtInstanceSysId, changeRiskAsmtSysId, changeRequestSysId, riskAsmtName) { var asmtUiPage = "assessment_take2"; var url = asmtUiPage + ".do"; url += "?sysparm_assessable_sysid=" + asmtInstanceSysId; url += "&sysparm_assessable_type=" + changeRiskAsmtSysId; url += "&sysparm_hide_header=true"; url += "&sysparm_hide_save=true"; url += "&sysparm_hide_cancel=true"; url += "&sysparm_hide_source_details=true"; url += "&sysparm_stack=no"; url += "&sysparm_return_url=" + this.getEncodedUrl(changeRequestSysId, asmtInstanceSysId); var dialogWindow = new GlideModal("change_risk_asmt_" + asmtInstanceSysId, false, "modal-lg"); dialogWindow.setTitle(riskAsmtName + ""); dialogWindow.setAutoFullHeight(true); dialogWindow.setPreference("sysId", changeRequestSysId); dialogWindow.setPreference("focusTrap", true); dialogWindow.on("beforeclose", this.deleteAsmt.bind(this, asmtInstanceSysId)); dialogWindow.renderIframe(url, function() { $j("iframe[src*='" + asmtUiPage + ".do']").contents().find("td[class='spacerCellSmall']").each( function(i,e) { e.remove(); } ); }); window.NOW.change_managment = { "riskAsmtAction" : "delete" }; window.g_parentDialog = dialogWindow; clicked = false; }, type: "ChangeRiskUiActionControl" });Related Problem: PRB1557141