Generate Email in Outbox
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2024 11:47 PM - edited ‎01-28-2024 11:49 PM
Hello Everyone,
I need a requirement :-
Generate an approval for any table. If the approval state remains 'requested' for 3 days without being approved, send a notification reminder. Additionally, if the approval is still in the 'requested' state after 5 days, check it again, and if it persists, send a remainder notification.
My workflow in which I tried two different script for getting notification
1.By creating a event registry -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 12:47 AM - edited ‎01-29-2024 12:48 AM
you need to design scheduled Job for this to trigger the notification Periodically , Ideally you need to query the Sysapproval table to get the Records which are in Requested state from Past 3days and then you need to get into the loop to send the reminders for respective source table , Adding Script below
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('state', 'requested');
gr.addQuery('source_table', 'sc_request');
gr.addQuery('sys_created_onRELATIVELE@hour@ago@72');
gr.orderBy('approver');
gr.query();
var count = gr.getRowCount();
while (gr.next()) {
var approver_current = gr.approver;
gs.eventQueue('demo.notified', gr, gs.getUserID(), approver_current);
gs.info("Number of Approval Records " + count);
}
Ensure Notification is on Sc_request table when to Send condition are configured Properly
also if you want to do this for different table , just add or condition to the Source table line and design the separate notifications Accordingly
let me know if you need any more information
Regards,
Shyamkumar
Regards,
Shyamkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 12:49 AM
But I only want to run the script in workflow can you help via run script?
Regards,
Suyash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 12:52 AM
Use Runscript activity and copy the Same script into it
Regards,
Shyamkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 12:58 AM
Hi @shyamkumar VK ,
Sorry for the inconvenience it is not working but one think I wanna ask it is possible to get the requirement without scheduled job?
Regards,
Suyash