- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2015 09:56 PM
Hi all,
I'm looking to develop a weekly notification for all the on call support groups using the same format as the formatted on-call schedule report. Unfortunately, we have a large number of groups and schedules and running the on-call formatted schedule report for all groups will timeout.
Any good ideas of how to accomplish this "formatted on call report" without any risk of a timeout regardless of the amount of on call schedules or assignment groups?
Thanks,
Berny
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2015 11:16 AM
I was able to do this. In case it's helpful for anybody else, here's how i did it...
a) Created a schedule job that will be in charge of invoking an event that will trigger a notification
b) Within the notification I have a mail script that will pull all the assignment groups and will generate the html leveraging the same functions that the system uses to generate the scheduled report.
Here goes the code of the mail script:
var emailBody = onCallSchedule();
template.print(emailBody);
function onCallSchedule(){
var groups = [];
var gr = new GlideRecord('sys_user_group');
gr.addQuery('JOINsys_user_group.sys_id=cmn_rota.group!active', '=', 'true');
gr.addOrderBy('name');
gr.query();
while (gr.next()) {
groups.push(gr.sys_id.toString());
}
var fsr = new FormattedScheduleReport();
fsr.buildSchedule(groups.join(','), gs.beginningOfThisWeek(), gs.endOfThisWeek());
var html = fsr.getReport();
return html;
}
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2015 11:16 AM
I was able to do this. In case it's helpful for anybody else, here's how i did it...
a) Created a schedule job that will be in charge of invoking an event that will trigger a notification
b) Within the notification I have a mail script that will pull all the assignment groups and will generate the html leveraging the same functions that the system uses to generate the scheduled report.
Here goes the code of the mail script:
var emailBody = onCallSchedule();
template.print(emailBody);
function onCallSchedule(){
var groups = [];
var gr = new GlideRecord('sys_user_group');
gr.addQuery('JOINsys_user_group.sys_id=cmn_rota.group!active', '=', 'true');
gr.addOrderBy('name');
gr.query();
while (gr.next()) {
groups.push(gr.sys_id.toString());
}
var fsr = new FormattedScheduleReport();
fsr.buildSchedule(groups.join(','), gs.beginningOfThisWeek(), gs.endOfThisWeek());
var html = fsr.getReport();
return html;
}
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2016 11:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2016 01:47 PM
Hi Maria,
That's right. I used the option: Automatically run a script of your choosing.
I hope this helps .
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2016 06:36 AM
Hi Berny,
Will you share the script you used in the Scheduled Job to trigger the notification? The one above is what I put in the Notification itself, right?
thanks,
Richelle