Assessment instance not getting created
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 01:26 AM
Hi Community,
I'm trying to create an assessment and trigger it using A UI Action, I was able to configure an Assessment, it is on the incident_task table. I've published the Assessment. the UI action is ready everything is set. when the conditions are met when I click on UI action the assessment is not getting opened, it shows the below error
I checked my user role permission, I have admin access as well but when I check the Assessment instance the instance itself is not created for the assessment I'm trying to access. any help is appreciated.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 01:28 AM
are you the one for whom the assessment instance is assigned?
share the complete script
did you check with the actual user for whom it's triggered?
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
04-15-2025 01:44 AM - edited 04-15-2025 01:49 AM
Hi Thanks for the response, below is the script
Here is the UI Action Script
g_form.hideAllFieldMsgs();
function invokeAssessment() {
g_form.hideAllFieldMsgs();
var isSubmitted = false;
var id = g_form.getUniqueValue();
var ga = new GlideAjax("CSRMAssessmentUtil");
ga.addParam("sysparm_name", "createSurvey");
ga.addParam("sysparm_id", id);
ga.addParam("sysparm_class", "incident_tsak");
ga.getXMLAnswer(function(res) {
var resArr = [];
resArr = res.split(",");
var taskAsmtID = resArr[0];
var assessmentName = resArr[1];
var url = "assessment_take2.do?sysparm_assessable_sysid=" + taskAsmtID.toString();
url += "&sysparm_assessable_type=" + assessmentName.toString();
var d = new GlideOverlay({
title: getMessage("Threat Assessment"),
iframe: url,
width: "60%",
height: "80%",
onBeforeClose: function() {
if (isSubmitted)
return;
var ga = new GlideAjax("CSRMAssessmentUtil");
ga.addParam("sysparm_name", "deleteAssessment");
ga.addParam("sysparm_id", taskAsmtID);
ga.getXMLAnswer(function(res) {});
},
onAfterClose: function() {
// If the form is submitted & Load Related List button is not shown,
// i.e. related lists are aready present, then we reload the form.
var isRelatedListDisplayed;
if (window.$j)
isRelatedListDisplayed = !$j('.related-list-trigger').is(':visible');
else
isRelatedListDisplayed = true; // Else no need to check since UI11 do not support onDemand RL
if (isSubmitted && isRelatedListDisplayed)
window.location.replace(g_form.getTableName() + ".do?sys_id=" + g_form.getUniqueValue());
},
onAfterLoad: function() {
d.autoDimension();
d.autoPosition();
d._createIframeShim();
var iframe = d.getIFrameElement();
var post_button = iframe.contentWindow.document.getElementById("post_survey");
if (post_button.addEventListener) {
post_button.addEventListener("click", function(eventObj) {
if (eventObj.view.mandatoryResult) {
isSubmitted = true;
}
});
} else {
post_button.attachEvent("onclick", function(eventObj) {
if (iframe.contentWindow.mandatoryResult) {
isSubmitted = true;
}
});
}
}
});
d.render();
window.g_parentDialog = d; // Accessed from UI page
});
}
Script Include
createSurvey: function() {
var taskSysId = this.getParameter("sysparm_id");
var table = this.getParameter("sysparm_class");
var assess_id = gs.getProperty('incident.audi.check.list.mim');
// Does an assessment already exists
var ta = new GlideRecord("asmt_assessment_instance");
ta.addQuery("task_id", taskSysId);
ta.addQuery('metric_type', assess_id);
ta.query();
while (ta.next()) {
this.deleteAssessmentServer(ta.getUniqueValue());
}
// First time assessment taken so create new one
sysIdCommaName = this._create_task_assessment(taskSysId, assess_id);
return sysIdCommaName;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 01:49 AM
the assessment instance you created is for which user?
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
04-15-2025 11:37 PM - edited 04-15-2025 11:44 PM
Hi Ankur,
This is a public assessment we are showing on a specific incident take type called "review" and the UI action to access the assessment is only available to particular group
also when trying to assign the assessment it shows the below error