Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

line managers for pending approvals for before 3days,then approval will go line

Nareshpatel
Tera Expert

sends reminder to line managers for pending approvals for before 3days,then approval will go line manager's manager which we are going to implement. i need script correction pls 

 

 


var app = new GlideRecord("sysapproval_approver");
app.addEncodedQuery("sys_created_onRELATIVEGT@dayofweek@ago@4^sys_created_onRELATIVELT@dayofweek@ago@3^source_table=sc_req_item^state=requested");
app.query();
while (app.next()) {
    var source = new GlideRecord("sc_req_item");
    if (source.get(app.document_id) && source.cat_item == "fd29303ddb4600d0e633adc3ca96198d") {
        var manager_email = app.approver.manager.email;
        app.approver = app.approver.manager;
        app.comments = "Approval Escalated - after 3 days";
        app.update();
        gs.eventQueue("kf_inactive_line_manager", app, "Test", manager_email);
    }
}
0 REPLIES 0