- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2013 08:34 AM
Hi, I am trying to take an answer of Risk Assessment and populate that info back to a field on the Change Form. I found a couple of articles on the wiki that include details on Incident survey results, but can seem to make it work for change and risk assessment.
Thanks in advance for any help you can provide.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2013 11:24 AM
You can modify the '//now iterate the answers' section. Get the sys_id of the question you want to capture the result for, just add a couple of lines after -
var key = arg.substring('QUESTION:'.length);
Assuming that you just want the value of the answer (which is the text of the answer, not the score), something like this might do it.
var key = arg.substring('QUESTION:'.length);
//below is the sys_id of the question you want the answer to
if(key == 'ae168e6b9d40b0c015cb6a9aa0e40572'){
var cr = new GlideRecord('change_request');
cr.get(taskID);
cr.work_notes = value; //update whatever field you want, value is the value of the answer
cr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2013 12:34 PM
While it's generally a bad idea to mess around with out of box script includes, we did in this case because there was a business need. We just have to keep a watch on it every time there's a new release. But here is what we did.
We added a few fields to the change_request table to track info about the risk assessments, including a field called 'Risk Score' (u_risk_score). Then modified the 'SurveyProcessor' script include.
We changed this:
if (taskAssessmentId) {
this.response.sendRedirect('task.do?sys_id=' + taskID);
}
else {
this.response.sendRedirect("survey_thanks.do?sysparm_survey=" + this.request.getParameter("sysparm_survey"));
}
To this:
if (taskAssessmentId) {
var uTask = new GlideRecord('change_request');
uTask.get(taskID);
uTask.work_notes = 'Risk assessment complete - Total risk value = ' + allscores;
uTask.u_risk_score = allscores;
uTask.u_risk_assessment_completed = gs.nowDateTime();
uTask.state = 0;
uTask.u_assessment_completed = true;
uTask.update();
this.response.sendRedirect('task.do?sys_id=' + taskID);
}
else {
this.response.sendRedirect("survey_thanks.do?sysparm_survey=" + this.request.getParameter("sysparm_survey"));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2022 04:24 AM
Hi
This is my requirement related to risk assessment .
Can you please help me with this requirement .
Thanks in advance .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2013 03:00 PM
This is very helpful. I think I can handle it from here, but I may be asking how to reference particular questions on the RA. I have some time tomorrow to give it another shot with your script. If I get it, I'll mark it answered!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2013 01:17 PM
Hi Jay,
Any idea How I can reference particular questions on the Risk assessment and then populate the answer to a field on the change request form. Your script was very helpful, but I'm struggling retrieving and populating that info.