Risk Assessment Form Link not visible in Standard Change form

Vijaya Aditya V
Tera Contributor

Risk Assessment Form Link not visible in Standard Change form.

I could see Risk assessment for Normal and Emergency change.

I have checked Risk Assessment UI Action Code as well. no where it mentioned type specific. Really not sure why it is not visible. i have attached UI Action script.

If you have any insight please help me on this.

Is it because of template based. As we aware Standard changes are based on templates. ?

*********************************************************************************************************************88

//# sourceURL=RiskAssessmentV2.js
function invokeAssessment() {
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.render();
window.g_parentDialog = dialogWindow;
},

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.render();
window.g_parentDialog = dialogWindow;
},

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.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;
},

type: "ChangeRiskUiActionControl"
});

**********************************************************************************************************************

 

1 ACCEPTED SOLUTION

Chander Bhusha1
Tera Guru

Hi Vijaya,

 

The Risk assessment UI action will not be appear in the Standard Change form as there is a condition written on ui action which restrict its visiblity on standard change.
The condition on Ui action is :(highlighted part will restrict the visiblity)

gs.hasRole('itil,sn_change_write') && !current.isNewRecord() && new RiskCalculator(current).showRiskAssessment()

You can remove this condition then it will visible on the form but you have to also configure the assessment for the Standard change as well as OOB its only available for Normal and emergency.

To make visible button the updated condition would be:
gs.hasRole('itil,sn_change_write') && !current.isNewRecord() 

And for assessment configure there 

Navigate to Risk Assessment(Change - Administration -- Risk assessment)

find_real_file.png

 

 

 

Mark helpful and correct if it helps.

Thanks,

CB

View solution in original post

3 REPLIES 3

Chander Bhusha1
Tera Guru

Hi Vijaya,

 

The Risk assessment UI action will not be appear in the Standard Change form as there is a condition written on ui action which restrict its visiblity on standard change.
The condition on Ui action is :(highlighted part will restrict the visiblity)

gs.hasRole('itil,sn_change_write') && !current.isNewRecord() && new RiskCalculator(current).showRiskAssessment()

You can remove this condition then it will visible on the form but you have to also configure the assessment for the Standard change as well as OOB its only available for Normal and emergency.

To make visible button the updated condition would be:
gs.hasRole('itil,sn_change_write') && !current.isNewRecord() 

And for assessment configure there 

Navigate to Risk Assessment(Change - Administration -- Risk assessment)

find_real_file.png

 

 

 

Mark helpful and correct if it helps.

Thanks,

CB

Thanks for the response.

I have tried below as you mentioned .

gs.hasRole('itil,sn_change_write') && !current.isNewRecord() && new RiskCalculator(current)

Still no luck

The below might be the simplest


Make condition changes to Change->Administration->Risk Assessments -> Condition (select type Standard or accordingly)

Also, make changes in:-

Assessment Categories tab -> Change Risk Assessment Category -> Condition (same changes to the condition as done in previous step)

  • Possible errors
    • Don’t go for removing condition statement will cause not defined errors.
    • If shows “there is no risk assessment for…” means changed the condition for category but have not changed the metric conditions or assmt_category


PS:-was looking for community for simple fix (i.e. without tweaking OOB scripts), but was not able to find here. Later on, resolved the issue in much simpler way than described here.