- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2016 06:49 PM
I would like to copy "workaround" notes from my Problem from to any related incidents when the problem status is set to "Closed/Resolved" or "Known Error"
Currently, nothing gets copied when the Problem status is changed and form is saved. I think this might be because, when saving the form, the notes in the "workaround" field get added into the comments/activity stream below work notes (and the workaround field looks blank).
Any suggestions?
I am trying to use an "After Update" business rule with the following script:
updateRelatedIncidents();
function updateRelatedIncidents() {
var inc = new GlideRecord("incident");
inc.addActiveQuery();
inc.addQuery("problem_id", current.sys_id);
inc.query();
while (inc.next()) {
if (inc.incident_state == 3)
inc.incident_state = 2;
if (!current.work_around.nil())
inc.work_notes = "Related problem " + current.number + " closed with the following Workaround:\n\n" + current.work_around;
inc.update();
}
}
Thank you!
Cheers,
Isaac
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2016 10:49 PM
I think the reason is that work_around is a journal entry. So it's empty when you tries to take data from it. Look below at the "communicate workaround" ui action. I think you taken most of it.. but as you can see it has the "getJournalEntry(1) on the end which means it takes the last entry in the journal.
Let me know if you get stuck.
//Göran
current.update();
workaround();
function workaround(){
var num = current.number;
var incident = new GlideRecord("incident");
incident.addQuery("problem_id", "=", current.sys_id);
incident.addQuery("incident_state", "<", 6);
incident.query();
while (incident.next()) {
incident.comments = (num + ' ' + current.work_around.getJournalEntry(1));
incident.update();
}
gs.addInfoMessage('Workaround communicated');
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2016 01:05 PM
Glad to help out