- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 07:55 AM
Hi All,
Can we copy worknotes in the task when it is updated in RITM of a catalog.
I have tried the below Business rule, looks like after and async is not working and when trying with Before, I am getting an error "Before Business Rules should not modify records on other tables".
I have kept the filter to run this BR on one specific catalog only with update/insert option.
(function executeRule(current, previous /*null when new*/ ) {
//if (current.cat_item.sys_id == '9690844b1b0e7f406380777b1d4bcb28') {
var tasks = new GlideRecord('sc_task');
tasks.addQuery('request_item', current.sys_id);
tasks.query();
while (tasks.next()) {
gs.info('update worknotes');
tasks.work_notes = current.work_notes;
tasks.update();
}
// }
})(current, previous);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 09:01 AM
@shivani39 Use the following BR script to copy work notes from RITM to SC Task.
(function executeRule(current, previous /*null when new*/ ) {
//if (current.cat_item.sys_id == '9690844b1b0e7f406380777b1d4bcb28') {
var tasks = new GlideRecord('sc_task');
tasks.addQuery('request_item', current.sys_id);
tasks.query();
while (tasks.next()) {
tasks.work_notes = current.work_notes.getJournalEntry(1);
tasks.update();
}
// }
})(current, previous);
Always use work_notes.getJournalEntry(1); to get the latest work notes.
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2023 03:45 AM
@shivani39 Please check if there is any existing BR on SC Task table which is copying the worknote from Task to RITM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2023 06:12 AM
// Run the Business Rule when the work notes field is updated
if (current.work_notes.changes()) {
// Get the task record associated with the RITM
var taskGR = new GlideRecord('task');
taskGR.addQuery('request_item', current.sys_id);
taskGR.query();
// Update the work notes field on the associated task record
while (taskGR.next()) {
taskGR.work_notes = current.work_notes.getJournalEntry(-1);
taskGR.update();
}
}
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/