- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2019 04:07 AM
Hi,
can you help me how to copy Approval comments into RITM, REQ, when RITM was REJECTED.
Not Working
here Approvals comments copying to RITM, but Not copied into REQ.
approvalcomments();
function approvalcomments()
{
var grr = new GlideRecord('sc_req_item');
grr.get(current.sysapproval);
grr.comments = current.comments;
grr.update();
var gr = new GlideRecord('sc_request');
gr.get(gr.request);
if(gr.next())
{
gr.comments = current.comments+" " +gr.number;
gr.update();
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2019 05:20 AM
Working example from my PDI (= tested). Working for Approvals on RITM.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2019 06:59 AM
Looks pretty oke. Only one thing: I don't think the ghh.get will work. Change it into ghh.addQuery.
ghh.get('request',gr.sys_id);
into
ghh.addQuery('request',gr.sys_id);
(where gr.sys_id is actually the same as current.sysapproval)
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2020 05:23 AM
I used the above solution and it works great. My business rule didn't have a state condition, just copy the contents regardless. The only thing I noticed is that if the approval goes to a group, it will try to copy the comments from each approval record. So if the group has 5 people who could approve, it has 5 additional actions that say comment copied from approval record and only 1 will have comments in it. I know this is old, but is there a way to restrict to only grab contents from the approval record that approved it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2019 05:30 AM
Hi chanikya,
These link might help you.
If I have answered your question, please mark my response as correct and/or helpful so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2019 06:01 AM
in case if WE have REQ level Approvals presented on REQ, then is it correct???
reqapprovalcomments();
function reqapprovalcomments()
{
var gr = new GlideRecord('sc_request'); // if REQ had approvals
gr.get(current.sysapproval);
gr.comments = current.comments;
gr.update();
var ghh=new GlideRecord('sc_req_item');
ghh.get('request',gr.sys_id);
ghh.query();
while(ghh.next())
{
//gs.addInfoMessage("RITM numbers is"+ghh.number);//
ghh.comments=current.comments;
ghh.update();
}
}