How to Copy Approval comments into RITM, REQ

chanikya
Tera Guru

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();
}
}

 

1 ACCEPTED SOLUTION

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

---

LinkedIn

find_real_file.png

find_real_file.png

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

13 REPLIES 13

Wayne Richmond
Tera Guru

Do you mean all approval comments or just comments from the approval record that was rejected?

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();
}
}

Anurag Tripathi
Mega Patron
Mega Patron

~Hi Chanikya,

You can write a business rule on Approval to copy the comments

Condition: 

find_real_file.png

 

And in the script write the code to copy  the comments.

 

-Anurag

-Anurag

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();
}
}