Update the work note field on the incident form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2023 10:25 PM
Update the work note field on the incident form. When the workaround field is updated on the problem from the update same workaround is on the incident table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2023 11:24 PM
Hi @zubair3 ,
If my understanding is correct you want to add work notes when workaround field updated on the problem record.
1] There is already OOB UI action available to communicate the workaround to related incident records you can find that in the related link section. Please find below screenshot.
2] If you want to achieve this without user interaction and should work automatically. you can write business rule and update the related incident records work-note field. Please find below screenshot and script you can use to achieve this.
var incident = new GlideRecord("incident");
incident.addQuery("problem_id", "=", current.sys_id);
incident.query();
while (incident.next()) {
if ( incident.active == true ){
incident.work_notes = current.workaround;
incident.update();
}
}
Please ask if you face any problem.
If I am able to help you with your question, Please click the Thumb Icon and mark as Correct.
Regards,
Pushkar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2023 12:28 AM
Hello @zubair3
Please refer to the community posts below.
The scripts that you can use to acheive this requirement is given below.
- Copy Work Notes from Problem to Incident and Vice Versa
- How to Copy Problem record Work Notes into Related Incident work notes
- Copy Comments from a Problem to all incidents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2023 04:01 AM
Hi @zubair3
Try below code
(function executeRule(current, previous /*null when async*/) {
var rec = new GlideRecord("incident");
rec.addQuery("problem_id", current.sys_id);
rec.addActiveQuery();
rec.query();
while (rec.next()) {
rec.work_notes = current.work_notes.getJournalEntry(1);
rec.update();
}
})(current, previous);
If you find the solution as helpful, Accept as Solution
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2023 04:04 AM
Hi @zubair3 I once used below script for populating the worknotes of an incident form to its related incident task form worknotes
After business rule :
condition: current.isValidRecord() &¤t.work_notes.changes()
script:
(function executeRule(current, previous /*null when async*/) {
updateRelatedIncidents();
function updateRelatedIncidents() {
var rec = new GlideRecord("problem_task");// Add the table name which needs to copy the work notes
rec.addActiveQueryry();
rec.addQuery("problem_id", current.sys_id);
rec.query();
while (rec.next()) {
rec .work_notes =current.work_notes.getJournalEntry(1);
rec .update();
}
}
})(current, previous);
Please mark it helpfu if it helps...
Thanks,
Sonia