Notification remainder for Request approval on daily basis

Vani14
Tera Contributor

we have created events scheduled jobs and notiffication for request appoval notification on daily bases but the code is not working could you please suggest.

Event:

Vani14_1-1706592009745.png

 

Scheduled jobs:

var app = new GlideRecord('sysapproval_approver');

app.addQuery('state','requested');
app.addQuery('sysapproval.sys_class_name', 'sc_request');
app.addEncodedQuery('sys_updated_onRELATIVELE@dayofweek@ago@1');

while(app.next()){

gs.eventQueue('sc.request.approval.reminder', app, app.approver, app.approver.getUserName());
app.update();

}

1 ACCEPTED SOLUTION

shyamkumar VK
Kilo Patron

@Vani14 ,

Seems you have Included Incorrect Event in the Script and also need some changes in script , have updated the Script , can you please try with this

 

 

var app = new GlideRecord('sysapproval_approver');
app.addQuery('state','requested');
app.addQuery('source_table', 'sc_request');
app.addQuery('sys_created_onRELATIVELE@dayofweek@ago@1'); // it should be created on not updated on
app.orderBy('approver');
app.query();
var count = app.getRowCount();

while(app.next()){
   var approver_current = app.approver;

gs.eventQueue('approval_reminder_request'.,app, gs.getUserID(), approver_current);
    gs.info("Number of Approval Records " + count);
}


}

 

 Regards,

Shyamkumar

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

View solution in original post

9 REPLIES 9

@shyamkumar VK ,
i have updated the script you mentioned and checked the event logs it's processed but the notification is not trigger i am attaching the notification screenshot please let me know.

Vani14_0-1706596835592.png

 

Can you please show me the Whom to Send Config

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

@Vani14 , enable Param2 as we are sending Approver in parm2 

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

shyamkumar VK
Kilo Patron

@Vani14 ,

Seems you have Included Incorrect Event in the Script and also need some changes in script , have updated the Script , can you please try with this

 

 

var app = new GlideRecord('sysapproval_approver');
app.addQuery('state','requested');
app.addQuery('source_table', 'sc_request');
app.addQuery('sys_created_onRELATIVELE@dayofweek@ago@1'); // it should be created on not updated on
app.orderBy('approver');
app.query();
var count = app.getRowCount();

while(app.next()){
   var approver_current = app.approver;

gs.eventQueue('approval_reminder_request'.,app, gs.getUserID(), approver_current);
    gs.info("Number of Approval Records " + count);
}


}

 

 Regards,

Shyamkumar

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar