Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to add approval comments to the Rejection notification in the Change workflow?

Naina4
Kilo Contributor

We had a requirements to populate the comments form approval form while rejecting the change request to the Rejection Notification which is triggering from the Change Workflow.

 

Can anyone help me how i can call the Approval comments in the change request rejection notification?

1 ACCEPTED SOLUTION

Punit S
Giga Guru

Hi Naina, 

 

ServiceNow stores the comments of approval/rejection in sysapproval_approver which is a join table for task and approvers . 

Now all information what your need would be in approver table and hence a glide query on it with sys ID would provide you what you need. 

Further more you can use event based notification to get rejected/approved comment on any notification using following code

var changeReq1 = new GlideRecord('change_request');
changeReq1.addQuery('sys_id', current.sysapproval);
changeReq1.query();
if(changeReq1.next())
{
gs.eventQueue('approval.updated',changeReq1,changeReq1.requested_by,changeReq1.requested_by);
// gs.eventQueue('approval.updated', current, gs.getUserID(), gs.getUserName());
}

 

 

Please mark this Helpful or Accepted solution if it solves your issue !

View solution in original post

1 REPLY 1

Punit S
Giga Guru

Hi Naina, 

 

ServiceNow stores the comments of approval/rejection in sysapproval_approver which is a join table for task and approvers . 

Now all information what your need would be in approver table and hence a glide query on it with sys ID would provide you what you need. 

Further more you can use event based notification to get rejected/approved comment on any notification using following code

var changeReq1 = new GlideRecord('change_request');
changeReq1.addQuery('sys_id', current.sysapproval);
changeReq1.query();
if(changeReq1.next())
{
gs.eventQueue('approval.updated',changeReq1,changeReq1.requested_by,changeReq1.requested_by);
// gs.eventQueue('approval.updated', current, gs.getUserID(), gs.getUserName());
}

 

 

Please mark this Helpful or Accepted solution if it solves your issue !