- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 05:45 AM
Hi Team,
We want to add Risk Assessment UI action to SOW . we are able to achieve it but after first submission we are calling UI page which will ask already submitted Yes or No if Yes is selected then it will re-show the submitted answer if No is selected then reload the form . this is happening on native view but not supported on SOW kindly suggest if anyone achieved this.
Thanks,
Pooja
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 11:47 PM
you might have to customize it heavily or create your own UI page which handles this logic.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 06:06 AM
so what did you use in native? if you are using UI page then same UI page can be rendered using g_modal.showFrame() in SOW.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 10:52 PM
Ui action risk assessment is calling the Ui page change_risk_completed_asmt_dialog, where the UI page is not supported in SOW, because of GlideDialogWindow.
check the function handleCompletedAsmt from below code
can you please guide how to enable the risk assessment in SOW?
we have declarative action risk assessment which is inactive, by activating the action is also not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 10:42 PM
Hello Ankur,
UI action is calling UI page change_risk_completed_asmt_dialog, UI page is not supporting in workspace.
Can some one please guide how to enable the UI action risk assessment in SOW?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 10:55 PM
Hi @Ankur Bawiskar , UI action risk assessment is calling the UI page change_risk_completed_asmt_dialog, where the UI page is not supported in SOW, because of GlideDialogWindow.
check the function handleCompletedAsmt from below code
function onClick(g_form) {
g_form.hideAllFieldMsgs();
if (!g_form.submitted && g_form.modified) {
handleDirtyForm(g_form);
} 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(function(response) {
processAsmt(response, g_form);
});
}
}
function handleDirtyForm(g_form) {
g_modal.showFrame({
url: "change_risk_asmt_dirty_form_dialog.do",
title: "Save changes",
size: "md",
preferences: {
displayValue: g_form.getDisplayValue(),
focusTrap: true
}
});
window.clicked = false;
}
function processAsmt(answer, g_form) {
answer = JSON.parse(answer);
if (!answer.hasAsmt) {
g_form.addInfoMessage("There are no risk assessments defined for this Change Request");
} else {
if (answer.asmtComplete) {
handleCompletedAsmt(g_form);
} else {
handleAsmt(answer, g_form);
}
}
}
// function handleCompletedAsmt(g_form) {
// g_modal.showFrame({
// url: "change_risk_completed_asmt_dialog.do",
// title: "Risk Assessment Complete",
// size: "md",
// preferences: {
// displayValue: g_form.getDisplayValue(),
// focusTrap: true
// }
// });
// window.clicked = false;
// }
function handleCompletedAsmt(g_form) {
g_modal.showFrame({
url: "change_risk_completed_asmt_dialog.do",
title: "Risk Assessment Complete",
size: "md",
preferences: {
displayValue: g_form.getDisplayValue(),
focusTrap: true
},
onClose: function(response) {
if (response === "yes") {
// Allow user to resubmit the form
g_form.setValue('state', 'new'); // or appropriate state
g_form.save(); // or g_form.submit()
} else {
g_form.addInfoMessage("Risk assessment remains unchanged.");
}
}
});
window.clicked = false;
}
function handleAsmt(answer, g_form) {
var url = "assessment_take2.do";
url += "?sysparm_assessable_sysid=" + answer.asmtInstanceSysId;
url += "&sysparm_assessable_type=" + answer.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=" + getEncodedUrl(answer.changeRequestSysId, answer.asmtInstanceSysId);
g_modal.showFrame({
url: url,
title: answer.riskAsmtName,
size: "lg",
height: 500,
onClose: function() {
handleAssessmentClose(answer.asmtInstanceSysId);
}
});
window.NOW.change_managment = { "riskAsmtAction": "delete" };
window.clicked = false;
}
function handleAssessmentClose(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(response) {
// Optional: add a message or reload
});
} else if (window.NOW.change_managment.riskAsmtAction === "reload") {
location.reload();
}
}
function getEncodedUrl(changeRequestSysId, asmtInstanceSysId) {
var url = "/change_risk_asmt_close_dialog.do";
url += "?sysparm_stack=no";
url += "&sysparm_id=" + changeRequestSysId;
url += "&sysparm_asmtInstanceSysId=" + asmtInstanceSysId;
return encodeURIComponent(url);
}
can you please guide how to enable the risk assessment in SOW?
we have declarative action risk assessment which is inactive, by activating the action is also not working.