One daily email reminder to the user which contains all pending approvals of that user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2023 07:15 AM - edited ‎10-21-2023 07:15 AM
Can someone suggest the scheduled job and email script which send the single notification to the user which have one or more that one pending approvals except change approvals and also include the link of "view all approvals " on portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2023 07:25 AM - edited ‎10-21-2023 07:27 AM
Hi @Adityanshu Sing ,
Can you try below code n let me know if it works for u or not
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('state', 'requested');
gr.addQuery('sys_class_name', '!=', 'change_request'); // Exclude change approvals
gr.groupBy('approver'); // Group by approver
gr.query();
while (gr.next()) {
var userId = gr.approver.toString();
var user = new GlideRecord('sys_user');
if (user.get(userId)) {
var email = user.email;
var link = gs.getProperty('glide.servlet.uri') + 'my_approvals.do';
var message = 'Hello ' + user.name + ',\n\n';
message += 'You have pending approvals. Click the link below to view all your approvals:\n'
message += link;
// Queue the email for sending asynchronously
gs.eventQueue('email.send', user, email, 'Pending Approvals Notification', message);
}
}
Create a notification which should trigger when above event is fired
Thanks,
Danish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2023 07:28 AM