Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

On-Call Email Notification

Beto
Mega Guru

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):

find_real_file.png

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;

      }

1 ACCEPTED SOLUTION

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.


View solution in original post

13 REPLIES 13

Sure! I only need the name - here is what I have in the Notification Email 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;


      }



And my output is when in Notifications:



find_real_file.png


Hi,



See the HTML generating code is from the method. I am sure that will be a script include. search "FormattedScheduleReport" in script include and send the code I can help you.



  1. var fsr = new FormattedScheduleReport();  
  2.             fsr.buildSchedule(groups.join(','), gs.today());  
  3.               var html = fsr.getReport();

okay, I was able to create a copy and modify the script includes file. Now I am able to get the results. Thanks!


Happy for you.



Thanks,


Nag.