Copy Work notes from Problem task to Problem Record Work notes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 02:39 PM
Hello Everyone. I am trying to create a client script so that when someone updates the work notes for the problem task that it will also put a copy of the work notes on the problem record. Similar to how a parent and child ticket works. How would I go about doing this? Please advise.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 08:29 PM
don't use client script.
you should use after update BR with condition as work notes changes and then copy it to problem
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 06:50 AM
Thanks for the suggestion. I created it and added this script. Can you please look it over:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 11:31 PM
### 📌 Subject:
Copy Problem Task work notes to Parent Problem record
---
### ❓ What I’m Trying to Do:
I want to automatically copy work notes from a Problem Task to its parent Problem, whenever work notes are updated.
---
### 🛠️ What I’ve Tried:
I used a Business Rule with `work_notes.getJournalEntry(1)` to pull the latest entry and update the parent Problem.
(function executeRule(current, previous /*null when async*/ ) {
// Only proceed if work_notes changed and there's a parent problem
if (current.work_notes.changes() && current.problem) {
var problemRec = new GlideRecord('problem');
if (problemRec.get(current.problem.toString())) {
// Get the latest journal entry
var latestNote = current.work_notes.getJournalEntry(1);
// Format note with task number
var taskNumber = current.getDisplayValue('number');
var note = '**Update from Problem Task [' + taskNumber + ']**:\n' + latestNote;
// Add to parent Problem work notes
problemRec.work_notes = note;
problemRec.update();
}
}
})(current, previous);