Scheduled Report to get emails of the approvers
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 12:41 PM
Hello,
I have created with a report which has requested items that is pending approvals with approver info.
I have scheduled that report to be sent through email to all the approvers generated in the report. The script on the scheduled report is from this link.
I changed all "assigned_to" to "Approver".
When I execute the scheduled report, no emails are generated. Please guide me what could be wrong
Attached the report and scheduled report script.
Script is schedule report:
answer = lookupUsersAndUpdateReport();
function lookupUsersAndUpdateReport(){
// look up "assigned_to" people -- assumes "table" is task-based
var senderArray = [];
var PrevSender = '';
var taskQueryGR = new GlideRecord(current.report.table);
taskQueryGR.addEncodedQuery(current.report.filter);
taskQueryGR.addEncodedQuery('assigned_toISNOTEMPTY');
taskQueryGR.orderBy('assigned_to');
taskQueryGR.query();
while (taskQueryGR.next()){
if (PrevSender != taskQueryGR.assigned_to + ''){ //filters out duplicate assignees
senderArray.push(taskQueryGR.assigned_to + '');
PrevSender = taskQueryGR.assigned_to + '';
}
}
current.user_list = senderArray.join(',');
current.setWorkflow(false);
current.update();
current.setWorkflow(true);
// only return true if there were records listed in the result set
if (senderArray.length > 0){
return true;
}
return false;
}
0 REPLIES 0