Reservation Management - building operational hours

Phoebe Edwards
Tera Expert

Is there a way to restrict reservation times to an organisation's/building's operational hours? e.g. if a building is open from 9am-5pm, can users be prevented from making a reservation that starts at 7am?

 

We are currently using a flow to automatically cancel reservations made outside of opening times, but is there a simpler way to achieve this?

1 ACCEPTED SOLUTION

Hello,

 

The flow is triggered when a workplace reservation is created/updated and the steps are as follows:

 

  1. Look up record (schedule which defines your operational hours)
  2. Verify inside schedule (rsv start date/time)
  3. Verify inside schedule (rsv end date/time)
  4. If either step 2 or 3 returns false,
    Update reservation state to cancelled

 

Note, the action in steps 2 and 3 is a custom action we have created - its inputs are a date/time and a schedule:

 

(function execute(inputs, outputs) {
    var date_time = new GlideDateTime(inputs['date_time']);
    var sched = new GlideSchedule(inputs['schedule_sid']);
    var answer = false
 
    if (sched.isInSchedule(date_time)) {
      answer = true;
    }
    outputs['inside_schedule'] = answer;
 
})(inputs, outputs);


So in this case, it's checking that the start/end time of the reservation is inside the schedule defined in step 1.

 

Hope this helps!!

View solution in original post

4 REPLIES 4

Kaveri3
Tera Contributor

Hello,

 

Can you please share detailed steps of flow to implement same.

 

Thanks

Hello,

 

The flow is triggered when a workplace reservation is created/updated and the steps are as follows:

 

  1. Look up record (schedule which defines your operational hours)
  2. Verify inside schedule (rsv start date/time)
  3. Verify inside schedule (rsv end date/time)
  4. If either step 2 or 3 returns false,
    Update reservation state to cancelled

 

Note, the action in steps 2 and 3 is a custom action we have created - its inputs are a date/time and a schedule:

 

(function execute(inputs, outputs) {
    var date_time = new GlideDateTime(inputs['date_time']);
    var sched = new GlideSchedule(inputs['schedule_sid']);
    var answer = false
 
    if (sched.isInSchedule(date_time)) {
      answer = true;
    }
    outputs['inside_schedule'] = answer;
 
})(inputs, outputs);


So in this case, it's checking that the start/end time of the reservation is inside the schedule defined in step 1.

 

Hope this helps!!

Hello Phoebe,

 

Thanks for solution, am trying to implement same but have one query-how to define/set value for schedule_sid ? Can you please suggest.

 

Thanks

Hi,

 

The schedule_sid is one of the inputs of the 'Verify inside schedule' action. The input in this case is the sys_id of the schedule from step 1. You can use the data pills in Flow Designer to find the correct input.