Override entire week in a follow-the-sun schedule (2 layers) | Community
Skip to main content
I have a schedule defined with two layers, each a week in length. Each of the layers defines a 12 hour shift, one for US based people and the otherĀ for India based people. For the US based layer I want to create an override for the entire week that just replaces the US based person and not the India one. In other words, a different person will take the US shift for the entire week, but the India person will remain unchanged. How do I do this without having to schedule an override for each 12 hour shift of the US person?

Hi Clara,


I can only think of ways to do this via API. The approach I was able to come up with was to first useĀ GET /schedules/{id}Ā on the schedule and then generate overrides based on entries of the ā€œrendered_schedule_entriesā€ property inside of theĀ ā€œfinal_scheduleā€ property,Ā which lists entries of the schedule.Ā Note that to constrain the entries to the desired week, you will needĀ to use the ā€œsinceā€ and ā€œuntilā€ query parameters when making thisĀ initial request.

Ā 

It is also possible to use the ā€œrendered_schedule_entriesā€ property of the desired layer within the ā€œlayersā€ property (each entry has a ā€œNameā€ property that can be used to identify it), but if the need is to target a user for overrides, using ā€œfinal_scheduleā€ is theĀ more reliable approach because it will take into accountĀ preexisting schedule overridesĀ and superseding schedule layers that can add or remove shifts of that user. Moreover, using ā€œfinal_scheduleā€Ā is idempotent; if there are no schedule entries after creating overrides the first time, no new overrides will be created because the user will have no shiftsĀ in the schedule for the given time range.

Ā 

After getting the schedule entries, takeĀ each entry matching the user’s ID from that list and use it toĀ composeĀ a list of overrides. That can then be usedĀ to create the overrides via POST /schedules/{id}/overrides. Each override in the list is an object as follows:

  • The ā€œstartā€ and ā€œendā€ property map to the originalĀ schedule entryĀ 
  • The ā€œuserā€ property should be a resource referenceĀ (an object with ā€œidā€ and ā€œtypeā€ properties)Ā specifyingĀ the user to be on-call forĀ the override

Reply