Skip to main content
GetUserSchedule()

Returns an object with user's schedule

Erik avatar
Written by Erik
Updated over 3 weeks ago

GetUserSchedule(mapslyUserId, date_from, date_to) returns an object with the user's schedule.

Use this function to retrieve the schedule information about a given user or multiple users, such as working hours, start and finish coordinates, and break information.

Note: the GetUserSchedule() function will only return information about the working days and will skip the non-working days. It will also take into account any exceptions created for that user.

Input

mapslyUserId: ID of a user for whom you want to retrieve information.
OR

mapslyUserId[]: array of IDs of users for whom you want to retrieve information

date_from: string, starting date for which you want to retrieve the schedule

date_to: string, ending date for which you want to retrieve the schedule

Example:

{{ GetUserSchedule(currentMapslyUser.userId.system, "2025-01-01", "2025-01-31") }}

Output

An object containing the following information about the specified user's schedule:

[
{
"userId":5178,
"timeFrom":1735736400,
"timeTo":1735783200,
"startLocationLat":37.7749295,
"startLocationLng":-122.4194155,
"finishLocationLat":NULL,
"finishLocationLng":NULL,
"breakType":"time_window",
"breakDuration":30,
"breakEarliestTime":1735758000,
"breakLatestTime":1735765200,
"breakMaxDrivingTime":NULL
},
{
"userId":5178,
"timeFrom":1735822800,
"timeTo":1735869600,
"startLocationLat":37.7749295,
"startLocationLng":-122.4194155,
"finishLocationLat":NULL,
"finishLocationLng":NULL,
"breakType":"time_window",
"breakDuration":30,
"breakEarliestTime":1735844400,
"breakLatestTime":1735851600,
"breakMaxDrivingTime":NULL
}
]
Did this answer your question?