Getting a users schedule

I’ve been tasked with creating a calendar view of who is scheduled to be working at what time on a week view calendar. Simple I thought, Add users to schedules and provide a mechanism for a supervisor to mark a schedule modification when that person is on vacation.

As I go through the system.user functions, I can’t find a method that will return a list of schedule entries for a user.

i.e. system.user.getUsersSchedule(user) which would return a list of schedule objects including schedule modifications which I would then iterate through to mark on a calendar when that person is schedule to be working.

Is there something that is available to do this?

Hi, check out this function :
https://docs.inductiveautomation.com/display/DOC79/system.user.getUser

As described in the documentation, you should be able to access the schedules for any username using user.get( 'schedules' )

To add to above, once you have your schedule object you can run a bunch of methods (i.e. .isTuesday() or .isAllDays(), .getAllDayTime() or whatever you need) on that to get the times for each day, then do:

schedModifications = user.getScheduleAdjustments()

to get an array of any changes you need to account for.

Brilliant! Thank you both.