How to send approval reminder after 2 days using schedule job twice

Sujay Sankpal
Tera Contributor

Hi Community,

My requirement is quite simple but still bit confused. 

1. A approval reminder should be triggered after 2 days i.e. on 3rd day if no action is taken.

2. The approval should trigger after 2 days i.e. on 3 day and still no action is taken then again wait for 2 days and then trigger notification on 5th day. Preferable approach currently I'm following is of scheduled job.

 

In approval table I'm trying to build a condition but it's not correct.

Any help would be deeply appreciated.

 

Thank You,

Sujay

1 ACCEPTED SOLUTION

Then give a try to flow designer as I mentioned. You can build this without code. 

View solution in original post

7 REPLIES 7

Anil Lande
Kilo Patron

Hi,

Can you please share your script?

 

var approvalGR = new GlideRecord('sysapproval_approver');
approvalGR.addQuery('sys_created_onRELATIVEGT@dayofweek@ago@3^sys_created_onRELATIVELT@dayofweek@ago@3^state=requested');
approvalGR.query();

while (approvalGR.next()) {
    gs.eventQueue('sn_lg_stock_cp.approval_reminder_itp', approvalGR, approvalGR.approver);
    approvalGR.comments = 'Reminder notification sent to approver.';
    approvalGR.update();
}

Hi,

Your are using addQuery() here, you need to use addEncodedQuery();

var approvalGR = new GlideRecord('sysapproval_approver');
approvalGR.addEncodedQuery('sys_created_onRELATIVEGT@dayofweek@ago@3^sys_created_onRELATIVELT@dayofweek@ago@3^state=requested');  // previously it was approvalGR.addQuery()
approvalGR.query();

while (approvalGR.next()) {
    gs.eventQueue('sn_lg_stock_cp.approval_reminder_itp', approvalGR, approvalGR.approver);
    approvalGR.comments = 'Reminder notification sent to approver.';
    approvalGR.update();
}

Dr Atul - LNG
Tera Patron

Hi @Sujay Sankpal 

 

How you are recording NO Action is taken? On which table you want to set this notifications.

 

Create Flow

Action

Look up record

Condition --> No action taken

Loop

For each

Wait for 2/5 days

Notification