Copy additional comments from requested item item to all catalog tasks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 12:03 AM
Hi,
I have a requirement where i have to copy the additional comments from requested item to all the catalog tasks.Once the item is approved all the comments after the RITM is approved, should be copied to each and every catalog tasks.
How can i achieve that?
Thanks.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2021 04:27 AM
hi,
the approval condition is not working. I added it in filter condition too and in the script condition but it is not working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2021 05:00 AM
Hi,
The approval condition works only when you have set the approval field to approved for that ritm in the workflow.
Go to your workflow and check if approval action is set to approved in the workflow after approved activity.
Kindly mark the comments as helpful if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 12:23 AM
Hi,
I have tried below script:(before insert/update BR on requested item)
in condition:current.approval=='Approved'
in script:
(function executeRule(current, previous /*null when async*/ ) {
var sc_task = new GlideRecord('sc_task');
sc_task.addQuery('request_item', current.sys_id);
sc_task.addActiveQuery();
sc_task.query();
while (sc_task.next()) {
sc_task.comments = current.comments.getJournalEntry(-1);
sc_task.update();
}
But it is copying all the comments before approval also. I guess condition is not working. Also, using getJournalEntry(-1); copies every comment even if one comment is added, it copies all the previous comments again and again.
My requirement is to copy all the comments after RITM is approved to all the catalog tasks and no comments is copied again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 12:27 AM
Hi,
Updated condition:
in condition:current.approval == 'approved'
when this BR runs it would pick the latest comments only from RITM.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 12:28 AM
should i use journalentry(-1) in the script?