Blocked Time Constraint
Hard constraint
The Blocked Time Constraint has been replaced by the EmployeeAvailabilityConstraint (strict and undesired variant). It is not suggested at this time to integrate with it, and instead to wait for the new constraint to be released.
Specify time periods when employees cannot be scheduled to work, either through particular weekdays, dates or day indices.
The constraint can also be configured to only apply to particular workTypes
.
See the payload example below to get started and check out the API reference for full configurability of the constraint.
The following defines a blocked time for employee 1 and 3 on Mondays, Wednesdays and Fridays between 09:00 and 17:00. This only applies to work type with ID 1.
{
"blockedTimeConstraints": [
{
"id": "btc-123",
"blockedTime": [
{
"scheduleDays": {
"weekDays": [1, 3, 5]
},
"startTime": "09:00",
"endTime": "17:00"
}
],
"workTypeIds": ["1"],
"employeeIds": ["1", "3"]
}
]
}
Blocked Time Constraint in the request payload
id required | string (constraintId) The id of the constraint should be UNIQUE in the context of constraint type. |
required | Array of objects |
workTypeIds | Array of strings (constraintWorkTypeIds) unique List of workType IDs for which the constraint applies. The workTypeIds should be present in workType section. If work type ids are not specified, the constraint will be applied to all work types. |
employeeIds | Array of strings (constraintEmployeeIds) unique List of employee ids for which the constraint applies. The employee ids must be present in the employee section. If not specified, the constraint will be applied to all employees. |
{- "id": "string",
- "blockedTime": [
- {
- "scheduleDays": {
- "weekDays": {
- "example_1": {
- "value": [
- 1
], - "summary": "All Mondays in the planning horizon."
}
}, - "dayIndexes": {
- "example_1": {
- "value": [
- 0,
- 1,
- 2,
- 3
], - "summary": "First four days of the planning horizon."
}
}, - "dates": {
- "example_1": {
- "value": [
- "2023-12-24",
- "2023-12-25"
], - "summary": "The 24th and 25th of December 2023."
}
}
}, - "startTime": "14:15:22Z",
- "endTime": "14:15:22Z"
}
], - "workTypeIds": {
- "example_1": {
- "value": [
- 0,
- 3
], - "summary": "The constraint will be applied only to work type with id 0 and 3."
}, - "example_2": {
- "value": [ ],
- "summary": "The constraint will be applied to all defined work types."
}
}, - "employeeIds": {
- "example_ints": {
- "value": [
- 1,
- 5,
- 3
], - "summary": "The constraint will be applied only to employees with id 1, 5 and 3."
}, - "example_all_employees": {
- "value": [ ],
- "summary": "The constraint will be applied to all defined employees."
}, - "example_string": {
- "value": [
- "Lars Petersen",
- "123qwerty"
], - "summary": "The constraint will be applied to listed employees."
}
}
}