- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2025 02:06 AM
Hi,
1.I have done with the copy of worknotes from case to related child incidents with the below code.
Business rule:
Insert/After and update:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2025 02:42 AM
have business rule on incident table After insert/update
use this
(function executeRule(current, previous /*null when async*/) {
// Check if worknotes have changed
if (current.work_notes.changes()) {
var identifier = '[Comment Sync]';
// Get the parent case
var parentCase = new GlideRecord('u_case');
if (parentCase.get(current.u_parent_case)) {
var y = current.work_notes.getJournalEntry(1);
if (y.indexOf(identifier) < 0) {
// Append worknotes to the parent case
parentCase.u_add_worknotes = identifier + '\n' + y;
parentCase.update();
}
}
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2025 02:27 AM - edited 04-25-2025 01:11 AM
You can created an after update BR when Child Incident got updated with Filter Condition
Work notes changes and Parent Case is not empty
var parentcase = new GlideRecord("<case table>");
parentcase.addQuery("sys_id", current.u_parent_case);
parentcase.query();
if(parentcase.next())
{
parentcase.work_notes = "Update from Child Incident" + current.getValue("number") + ":" + current.work_notes.getJournalEntry(-1);
parentcase.update();
}
}
You can also use Flow Designer for the same to update
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2025 02:42 AM
have business rule on incident table After insert/update
use this
(function executeRule(current, previous /*null when async*/) {
// Check if worknotes have changed
if (current.work_notes.changes()) {
var identifier = '[Comment Sync]';
// Get the parent case
var parentCase = new GlideRecord('u_case');
if (parentCase.get(current.u_parent_case)) {
var y = current.work_notes.getJournalEntry(1);
if (y.indexOf(identifier) < 0) {
// Append worknotes to the parent case
parentCase.u_add_worknotes = identifier + '\n' + y;
parentCase.update();
}
}
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2025 03:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2025 03:19 AM
Glad to help.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader