- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
11-04-2019 01:23 PM
Have a client that for Problem Task, they want they field changes that get logged in the Activity Stream copied up to the Activity Stream of the parent Problem ticket. I'm already copying the Work Notes and Comments up, but need to get the field changes. I've found where they are stored (sys_history_set), but from looking around posts, I don't see any other way to get the info other than from that table, or the audit table. Am I missing something?
Solved! Go to Solution.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
11-04-2019 01:49 PM
Hello,
That's correct. It's for the focused table/audit table within that audit log. What you can do is also create an update Business Rule on the problem task table and have those changes "echo'd" up to the parent problem in the work notes section.
I.e.:
-technician updates problem task record short description field, state, and priority.
-the BR you setup on problem task with this code can write to parent
(function executeRule(current, previous /*null when async*/) {
var changeFields;
var gr = new GlideRecord('problem');
gr.addQuery('sys_id', current.problem);
gr.query();
if (gr.next()) {
for (var x in current){
if (current[x] != previous[x]) {
changedFields += 'Field ' + x + ' has changed on record ' + current.number + ' from ' + previous[x] + ' to ' + current[x] + '\n';
   }
  }
gr.work_notes = changedFields;
gr.update();
 }
})(current, previous);
All in one work note, each entry on it's own line.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
11-05-2019 10:24 AM
Hi,
Well...the one that got you to your answer or on the right track, you can mark as Correct and then any others as Helpful.
Seems my code/example was used pretty much throughout all this, so unsure if I helped jump start this thing.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
