How to copy Additional commentd from a SCTASK to a RITM?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 07:21 AM
Hello experts, please I need your help, I'm trying to use a BR to copy "Additional comments" from a SCTASK to a RITM, I searched different ideas in the community but I am having the following issue:
I'm using this code from this post:
https://community.servicenow.com/community?id=community_article&sys_id=6b26c55cdb728550dd886c8e13961928
but the issue is that when I add a comment in "Additional Comments", it gets copied over to the RITM with no problem, but the comment I add in the SCTASK gets duplicated:
Is there something I need to modify?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 07:39 AM
There may be possibility that your BR is running multiple times ,check your BR filter conditions and add logging in script to see if its triggering multiple times like this
gs.log("BR is Running :"+ current.number, "My_BR");
go to system logs search the log by applying filter : source is "My_BR" if you see multiple logs for the same sc task transaction.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 07:39 AM
Hi Jesus,
Write a before insert and update business rule with the below code and condition when additional comments changes on the sc_task, it will work.
****************************
(function executeRule(current, previous /*null when async*/ ) {
var taskComments = current.comments.getJournalEntry(1).split(' (Additional comments)')[1].trim();
var ritm = new GlideRecord("sc_req_item");
if (ritm.get(current.request_item)) {
ritm.comments = "Comments from Task:" + "" + current.number + ":\n" +taskComments;
ritm.update();
// ritm.setWorkflow(false);
}
*******************************
Regards,
Nayan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 08:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 07:39 AM
If you want to copy the additional comments one way only, from sc task to RITM:
Follow below article:
Copy additional comments from sc task to ritm
Aman Kumar