Update the Incident Work Notes that Change has been Rejected

Sakshi Lambat
Tera Contributor

When the Change Request moves from Authorize to Scheduled state then Approval gets generated, if we reject the approval then the incident work notes must get updated that the 'Change has been rejected for the incident'. Please help me to figure out this

1 ACCEPTED SOLUTION

There is definitely an extra } there, try this:

 

(function executeRule(current, previous /* previous state */) {

        var incidentGR = new GlideRecord('incident');
        if (incidentGR.get('rfc', current.sys_id)) {
            // Update incident work notes
            incidentGR.work_notes = 'Change request has been rejected: ' + current.number;
            // Here you can also add a status change maybe
            incidentGR.update();
        }

})(current, previous);

View solution in original post

16 REPLIES 16

Try to add Approval = Rejected on those conditions at the Business Rule and try it again.

Yes it is working now. Thank you so much for the help😁