Weekdays and Weekend reporting for Change

Amit Kishore
Tera Contributor

Hi Team,

 

We have a requirement, we have to create  report on change table, where we would like to see reports on change implemented between "Monday to Friday"  and "Friday to Monday" so that client can ensure how many changes has been implemented during weekdays and weekends.

is there any OOB solution we have ? or we have to go for scripting ?

Note : We have Planed start and planed end date to capture the date and time.

 

Regards,

Amit

 

 

9 REPLIES 9

Thomas_Davis
Administrator
Administrator
First, I think that you need to better define, Monday - Friday, and Friday - Monday. Your Friday’s will overlap, perhaps. Are you thinking about 8 to 5 or 24 hours?

Outside all of that, you could do:
  • Create another column in your change table. Maybe something like weekdays or whatever you want to call it. You will want to make it a True/False type. In my script example, it is workday.

  • Then you will want to create a Business Rule that will trigger when the planned start date changes on the change_request table. Something like this:

find_real_file.png
 
You could put something similar for the Script under Advanced:
 
(function executeRule(current, previous /*null when async*/) {

    var checkTime = current.start_date.getGlideObject();
    if(current.work_start){
         checkTime = current.work_start.getGlideObject();
    }
 
    var sched = new GlideSchedule(‘090eecae0a0a0b260077e1dfa71da828’); // change to the schedule you want

    if (sched.isInSchedule(checkTime)) 
    {
         current.u_is_workday = true;
    } else {
        current.u_is_workday = false;
    }
})(current, previous);
 
  • I wouldn’t recommend putting an actual sys_id in the script. I used it for my testing. — perhaps a sys_property so this can easily be changed
  • You would also need to run a fix script to update all of your existing records to populate the new field.

Try and utilize the existing schedules that are in the platform if you can when writing your script.

find_real_file.png

I hope this helps and points you in a direction to create what you are looking for.

@Thomas Davis : This is really simple and nice approach however I have not an option to create/extend column/table in client instance, we have been asked to check OOB / scripting way to achieve it. 

Please guide an alternate way to achieve it.

Sam Ogden
Tera Guru

Hi Amit,

Please see this great video from @Robert Fedoruk on reports using the 'trend' option.

This should show how you can create reports based on set days of the week and should hopefully solve what your looking for.

Let me know if this helps, and if so mark helpful or correct.

Thanks

Sam

Hi Sam,

I watched the video and created a report using Trend option to show the weekend changes. 

How can I include the changes that have a large window where the planned start is not necessarily on Weekend but are scheduled for few weeks? like for example if I have a change that starts Jan 1, 2021 and end February 1st, 2021?

This change should appear on my weekend change report, as part of it is on weekends, any suggestions?

 

Thanks