Copy additional comments from RITM task to catalog task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 01:31 AM
Hi,
I am having a requirement. When the requester or user is updating the additional comments on RITM task then it should get copied to catalog task. Also, if the comments or work notes are updated by system then it should not copy.
It should copy only when the user is updating. Can anyone help to achieve this?
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 01:39 AM
Hi you can have a BR after update on RITM and
Condition :
UpdatedBy doesnot contain system and
additional comment changes
Script:
var task = new GlideRecord('sc_task');
task.addQuery('request_item',current.sys_id);
task.query();
while(task.next())
{
task.comments = current.comments.getJournalEntry(1);
task.update();
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 01:41 AM
Hi
Check the below link it's have your answer
https://community.servicenow.com/community?id=community_question&sys_id=0de670a31b3fd054d2ccea89bd4bcb4d
https://community.servicenow.com/community?id=community_question&sys_id=ae701de9dba42b001cd8a345ca961981
Thanks
Chandu Telu
Please Mark ✅ Correct/helpful, if applicable,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 01:51 AM
Hi,
Never use before Business rule to update or insert in such scenarios.
Since you want to update another table i.e. sc_task when RITM comments gets updated you should always use After update BR
BR: Condition
Additional Comments Changes
Script:
use below script to copy the latest comments from RITM to SC Task
(function executeRule(current, previous /*null when async*/) {
var sctask = new GlideRecord('sc_task');
sctask.addQuery('request_item', current.sys_id);
sctask.query();
while(sctask.next()) {
sctask.comments = current.comments.getJournalEntry(1);
sctask.update();
}
})(current, previous);
Regards
Vaishnavi