Approval script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 10:09 PM
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();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 10:57 PM
Hi,
This can be done using flow designer.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 11:05 PM
Hello @Saurabh Gupta ,
Thank you for your Quick reply!
Actually i have not done any automation using flow.
Can you pls support to achieve using the scripts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 11:21 PM
Hi,
Using Flow Designer, this will be very easy to control.
Using scripts, this will be a bit tough, and you need to create few custom fields.
If you want, I can share a sample flow for the same.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 11:25 PM
Hi @Saurabh Gupta ,
Ok please share me the sample flow ,will follow the same.thanks!