cmn_schedules - How to calculate how many hours are in a month?

kemmy1
Tera Guru

We have a custom scheduling tool to schedule appointments.  We are looking to see what the availability is for an office (they have a cmn_schedule record and an appointment table).  Is there any way to calculate how many hours there are in a month according to their schedule?  (So for example, if their schedule is set up for 8 hours every Wednesday, I'd like to know how many hours that is in the month of April).

 

I'm just looking for something simple as far as, how can I even gather this information? (Of course there is no huge table that this data is collected in)

 

I'm researching how the calendar is displayed (using a scheduled page).  They use an AJAX processor:  

var g = new GlideRecord('cmn_schedule');
g.addQuery('name', 'application');
g.query();
while (g.next()) {
schedulePage.addSchedule(g.sys_id, '#808080', null, true);

}

 

Is this possible?

 

Lisa

 

 

1 REPLY 1

Oleksiy Kosenko
Tera Expert

Is there any way to calculate how many hours there are in a month according to their schedule?

 

See 

DurationCalculator - calcScheduleDuration(String startTime, String endTime)

https://docs.servicenow.com/bundle/vancouver-api-reference/page/app-store/dev_portal/API_reference/D...