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. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

7 REPLIES 7

Anil Lande
Kilo Patron

Hi,

Can you please share your script?

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

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();
}
Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Dr Atul G- LNG
Tera Patron
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

 

 

 

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************