- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 10:40 AM
Hi Team,
I have an implementation in which we disabled the shopping cart from the service catalog, therefore, for each REQ we have only one RITM, we now have a requirement to copy all the comments and work notes from the request to its related RITM and the related Catalog tasks, in order to improve the interaction between end users who interact in the REQ and fulfiller users who interact in the RITM. Has any of you guys worked in something like this?
Any help would be greatly appreciated.
Thank you.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 12:04 PM
HI,
i assume that you want to copy the comments from REQ to RITM and then RITM to SCTASK as soon as comments are inserted on REQ.
IF so then use after update BR on REQ and condition will be comments change
See below:
Condition : current.comments.changes() || current.work_notes.changes()
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request',current.sys_id);
gr.query();
while(gr.next()){
gr.comments = current.comments;
gr.work_notes = current.work_notes;
gr.update();
var tsk = new GlideRecord('sc_task');
tsk.addQuery('request_item',gr.sys_id);
tsk.query();
while(tsk.next()){
tsk.comments = current.comments;
tsk.work_notes = current.work_notes;
tsk.update();
}
}
})(current, previous);
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 11:34 AM
Hi Johansec Thank you very much for your help, yes we actually want to get any update to those fields on any record wether it is RITM or REQ to be replicated in the other.
What we have seen is that it depends much on the users, end users tend to comment on the REQ, and fulfillers in the RITM, we just want to have them both still able to communicate with one another without them having to change the record on which they usually interact.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 12:04 PM
HI,
i assume that you want to copy the comments from REQ to RITM and then RITM to SCTASK as soon as comments are inserted on REQ.
IF so then use after update BR on REQ and condition will be comments change
See below:
Condition : current.comments.changes() || current.work_notes.changes()
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request',current.sys_id);
gr.query();
while(gr.next()){
gr.comments = current.comments;
gr.work_notes = current.work_notes;
gr.update();
var tsk = new GlideRecord('sc_task');
tsk.addQuery('request_item',gr.sys_id);
tsk.query();
while(tsk.next()){
tsk.comments = current.comments;
tsk.work_notes = current.work_notes;
tsk.update();
}
}
})(current, previous);
Thanks,
Ashutosh Munot

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 12:06 PM
Useful links:
https://community.servicenow.com/community?id=community_question&sys_id=85f3c3e5dbd8dbc01dcaf3231f96199e
https://community.servicenow.com/community?id=community_question&sys_id=3299cba5db5cdbc01dcaf3231f961922
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 12:44 PM
Hi i have subscribed this post for learning purpose,
i'm able to achieve few things except coping comments from Parent (REQ) to child (RITM),
so basically i wrote AFTER BR, since we are updating another table record.
But result what i'm seeing is :
Req number is transferred as Parent Number but Comments are not been copied.
Any Help ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 01:03 PM
Hi,
Use before Update BR and try
Thanks,
Ashutosh