
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 07:25 PM
I am trying to send out an on-call email notification of our managers. How can I exclude the everything but today's current assign person of a group? My script show's tomorrow date for some reason. I need some guidance.
My desired output:
Manager On-Call Primary John Smith 7/20/2017
Current Output (looks messy):
My 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.today());
var html = fsr.getReport();
return html;
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2017 06:06 PM
Hi Bryant,
The above code is just to tell how can you get the user name alone.
If you want the complete solution please paste the complete code
I think there will be a script include "FormattedScheduleReport()" which you are using to build the HTML. Paste that code also so I can have a look.
Thanks,
Nag.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 11:30 PM
Hi Baker,
Some methods use the Java Virtual Machine time zone when retrieving or modifying a date and time value. Using these methods may result in unexpected behavior. Use equivalent local time and UTC methods whenever possible.
Try to user GlideDateTime API to work with dates.
Thanks,
Nag.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 11:19 PM
Does anyone know how I can pull just John Smith? I only want the name of the current scheduled person.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 11:38 PM
var gr = new GlideRecord("sys_user");
What ever querry u want
if(gr.next()) {
var username = gr.getValue('user_name');
}
Thanks,
NAg.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2017 12:22 AM
I am getting a null now. What am I missing?
var emailBody = onCallSchedule();
template.print(emailBody);
function onCallSchedule(){
var groups = [];
var gr = new GlideRecord("sys_user");
gr.addQuery('JOINsys_user_group.sys_id=cmn_rota.group!active', '=', 'true');
gr.addOrderBy('name');
gr.query();
if(gr.next()) {
var username = gr.getValue('user_name');
}
}