Copy RITM Worknotes to SCTASK - ServiceNow Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2025 10:23 PM
Hi Team ,
I have to whcih ever we have updated in additonal comments the same should be copied in sctask worknotes only a particular catalog item
I have configured After update BR for
(function executeRule(current, previous /*null when async*/) {
var latestComment = current.comments.getJournalEntry(1); // get latest additional comment
var taskGr = new GlideRecord('sc_task');
taskGr.addQuery('request_item', current.sys_id);
taskGr.query();
while (taskGr.next()) {
taskGr.work_notes = "Customer Comment from RITM:\n" + latestComment;
taskGr.update();
}
})();
Test Reults -
comments were not copied ritm to sctask
can any one please help me what was the mistake here .
@Ankur Bawiskar could you pllease help me here on my mistake
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2025 10:32 PM
Did you check activity stream in sctask?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2025 10:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2025 10:44 PM
HI @nameisnani ,
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var latestComment = current.comments.getJournalEntry(1); // get latest additional comment
var taskGr = new GlideRecord('sc_task');
taskGr.addQuery('request_item', current.sys_id);
taskGr.query();
while (taskGr.next()) {
taskGr.work_notes = "Customer Comment from RITM:\n" + latestComment;
taskGr.update();
}
})(current, previous);
you are missing the current and previous parameters in the last line
replace the entire script with the shared script
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 11:39 PM
Hi @nameisnani ,
Have you had a chance to review my response?
If you find it helpful could you please give a like and accept it as a solution and close the thread
Thanks
Chaitanya