The CreatorCon Call for Content is officially open! Get started here.

Approval script

akin9
Tera Contributor

Hello Experts,

We want to create a reminder email notification for pending approval "SC_REQ_ITEM".

Requirement

1.want to give a reminder email every 7 days till 60 days from created.If any RITM is pending for approval.

2. if above conditions are met "Request - Reminder" notification needs to be sent 

how to add the notification on the script?

 

we have tried below script using scheduled job but not working .

or else can we achieve any other ways?. kindly support.

 

var ritm = new GlideRecord('sc_req_item');
var encQuery = 'active=true^state=1'; //1 is state pending approval;
ritm.addEncodedQuery(encQuery);
ritm.query();

while (ritm.next()) {

var chkApprvl = new GlideRecord('sysapproval_approver');
chkApprvl.addQuery('document_id', ritm.sys_id);//find the approval related to this item
chkApprvl.addQuery('state', 'requested');//its state should be requested
chkApprvl.addQuery('sysapproval.sys_class_name','sc_req_item');
chkApprvl.addQuery('sys_updated_onRELATIVELE@dayofweek@ago@7'); //this checks if the approval has not be updated for 7 days

chkApprvl.query();

while(chkApprvl.next()) {

ritm.work_notes = 'Reminder email to approver sent after 7 days.';
ritm.update();
}
}

13 REPLIES 13

Saurabh Gupta
Kilo Patron

Hi,
PFA.


Thanks and Regards,

Saurabh Gupta

Hi @Saurabh Gupta  ,

Thanks for the support. i have created a custom notification already ,im not able to add that notification.

can you please.

Hi,
You can trigger existing notification. You need to make sure the send when should set to triggered.

SaurabhGupta_0-1694074697888.png
Change the flow action to send notification like below-

 

SaurabhGupta_1-1694074816725.png

 

 

 

 


Thanks and Regards,

Saurabh Gupta

Hi @Saurabh Gupta  ,

Sorry for the delay ! Hope you are doing well,

I have done the changes but reminder notification is not triggering.

For testing purposes keep 2mins reminder.

can you pls check waht i have missed.

 

 

akin9_1-1694408354237.pngakin9_2-1694408397894.pngakin9_3-1694408445403.png

 

 

Thanks

 

Hi,
Do you have flow execution for this flow?

 

 


Thanks and Regards,

Saurabh Gupta