Schedule Rule Override Assignments

A schedule rule defines restrictions and requirements that ensure a schedule meets certain criteria.

You can assign, update, delete, and retrieve details about schedule rule override assignments using operations against the /v1/commons/persons/schedule_rule_overrides resource.

Prerequisites

A person's person ID is the same as the personKey and employee ID, and is not the same as the person number.

The person in this example has a person ID of 100 and a person number of 20190.

Example

In this example, we assign, verify, update, and delete a person's schedule rule override assignments.

Create the assignment

The create request:

  • uses personIdentity to identify the person using their person number
  • uses the overrideRules array to define the schedule rule overrides to assign
  • uses rule, overrideDetails, and ruleParameterType to define the schedule override rule
  • uses value to define the quantity of the specified rule
  • uses effectiveDate and expirationDate to define the effective date and the expiration date of each assignment

The assignment below restricts the employee to being scheduled a maximum of 3 days per week and a maximum of 2 shifts per day on Monday, Tuesday, and Wednesday.

Example request

Call POST /v1/commons/persons/schedule_rule_overrides with the following request payload.

{
    "personIdentity": {
        "personNumber": "20190"
    },
    "overrideRules": [
        {
            "rule": {
                "qualifier": "ERULE_MAX_DAYS_WK"
            },
            "effectiveDate": "2020-02-10",
            "expirationDate": "2020-02-28",
            "overrideDetails": [
                {
                    "ruleParameterType": {
                        "qualifier": "ERPARAM_SCHED_DAYS"
                    },
                    "value": {
                        "quantity": 3
                    }
                }
            ]
        },
        {
            "rule": {
                "qualifier": "ERULE_MAX_SHIFTS_DAY"
            },
            "effectiveDate": "2020-02-17",
            "expirationDate": "2020-02-21",
            "overrideDetails": [
                {
                    "ruleParameterType": {
                        "qualifier": "ERPARAM_SHIFTS"
                    },
                    "daysOfWeek": [
                        {
                            "id": 2,
                            "name": "MONDAY"
                        },
                        {
                            "id": 3,
                            "name": "TUESDAY"
                        },
                        {
                            "id": 4,
                            "name": "WEDNESDAY"
                        }
                    ],
                    "value": {
                        "quantity": 2
                    }
                }
            ]
        }
    ]
}

Example response

A success response returns HTTP status code 200 and a response body similar to the following example.

{
    "personIdentity": {
        "personNumber": "20190",
        "personKey": 100
    },
    "overrideRules": [
        {
            "id": 152,
            "rule": {
                "id": 38,
                "qualifier": "ERULE_MAX_SHIFTS_DAY"
            },
            "effectiveDate": "2020-02-17",
            "expirationDate": "2020-02-21",
            "overrideDetails": [
                {
                    "ruleParameterType": {
                        "id": 18,
                        "qualifier": "ERPARAM_SHIFTS"
                    },
                    "daysOfWeek": [
                        {
                            "id": 2,
                            "name": "MONDAY"
                        },
                        {
                            "id": 3,
                            "name": "TUESDAY"
                        },
                        {
                            "id": 4,
                            "name": "WEDNESDAY"
                        }
                    ],
                    "value": {
                        "quantity": 2
                    }
                }
            ]
        },
        {
            "id": 151,
            "rule": {
                "id": 23,
                "qualifier": "ERULE_MAX_DAYS_WK"
            },
            "effectiveDate": "2020-02-10",
            "expirationDate": "2020-02-28",
            "overrideDetails": [
                {
                    "ruleParameterType": {
                        "id": 2,
                        "qualifier": "ERPARAM_SCHED_DAYS"
                    },
                    "value": {
                        "quantity": 3
                    }
                }
            ]
        }
    ]
}

Verify the assignment

To verify, you can call GET /v1/commons/persons/schedule_rule_overrides?person_number={personNumber} or GET /v1/commons/persons/schedule_rule_overrides/{personId}.

Calling GET /v1/commons/persons/schedule_rule_overrides?person_number=20190 or GET /v1/commons/persons/schedule_rule_overrides/100 returns:

{
    "personIdentity": {
        "personNumber": "20190",
        "personKey": 100
    },
    "overrideRules": [
        {
            "id": 152,
            "rule": {
                "id": 38,
                "qualifier": "ERULE_MAX_SHIFTS_DAY"
            },
            "effectiveDate": "2020-02-17",
            "expirationDate": "2020-02-21",
            "overrideDetails": [
                {
                    "ruleParameterType": {
                        "id": 18,
                        "qualifier": "ERPARAM_SHIFTS"
                    },
                    "daysOfWeek": [
                        {
                            "id": 2,
                            "name": "MONDAY"
                        },
                        {
                            "id": 3,
                            "name": "TUESDAY"
                        },
                        {
                            "id": 4,
                            "name": "WEDNESDAY"
                        }
                    ],
                    "value": {
                        "quantity": 2
                    }
                }
            ]
        },
        {
            "id": 151,
            "rule": {
                "id": 23,
                "qualifier": "ERULE_MAX_DAYS_WK"
            },
            "effectiveDate": "2020-02-10",
            "expirationDate": "2020-02-28",
            "overrideDetails": [
                {
                    "ruleParameterType": {
                        "id": 2,
                        "qualifier": "ERPARAM_SCHED_DAYS"
                    },
                    "value": {
                        "quantity": 3
                    }
                }
            ]
        }
    ]
}

Update the assignment

To update the person's schedule rule override assignments, call PUT /v1/commons/persons/schedule_rule_overrides with the following request payload.

This PUT operation behaves like a PATCH and adds the additional work rule override assignments to the employee's existing assignments. You cannot pass the existing assignments in the PUT payload without generating an error.

This example adds a schedule rule override limiting the employee to one job segment per shift on Monday, Tuesday, and Wednesday, effective the same workweek as the maximum shifts per day limitation.

Example request

{
    "personIdentity": {
        "personNumber": "20190",
        "personKey": 100
    },
    "overrideRules": [
        {
            "rule": {
                "qualifier": "ERULE_MAX_JOBSEG_SHIFT"
            },
            "effectiveDate": "2020-02-17",
            "expirationDate": "2020-02-21",
            "overrideDetails": [
                {
                    "ruleParameterType": {
                        "qualifier": "ERPARAM_JOBSEGS"
                    },
                    "daysOfWeek": [
                        {
                            "name": "MONDAY"
                        },
                        {
                            "name": "TUESDAY"
                        },
                        {
                            "name": "WEDNESDAY"
                        }
                    ],
                    "value": {
                        "quantity": 1
                    }
                }
            ]
        }
    ]
}

Example response

{
    "personIdentity": {
        "personNumber": "20190",
        "personKey": 100
    },
    "overrideRules": [
        {
            "id": 153,
            "rule": {
                "id": 35,
                "qualifier": "ERULE_MAX_JOBSEG_SHIFT"
            },
            "effectiveDate": "2020-02-17",
            "expirationDate": "2020-02-21",
            "overrideDetails": [
                {
                    "ruleParameterType": {
                        "id": 16,
                        "qualifier": "ERPARAM_JOBSEGS"
                    },
                    "daysOfWeek": [
                        {
                            "id": 2,
                            "name": "MONDAY"
                        },
                        {
                            "id": 3,
                            "name": "TUESDAY"
                        },
                        {
                            "id": 4,
                            "name": "WEDNESDAY"
                        }
                    ],
                    "value": {
                        "quantity": 1
                    }
                }
            ]
        },
        {
            "id": 152,
            "rule": {
                "id": 38,
                "qualifier": "ERULE_MAX_SHIFTS_DAY"
            },
            "effectiveDate": "2020-02-17",
            "expirationDate": "2020-02-21",
            "overrideDetails": [
                {
                    "ruleParameterType": {
                        "id": 18,
                        "qualifier": "ERPARAM_SHIFTS"
                    },
                    "daysOfWeek": [
                        {
                            "id": 2,
                            "name": "MONDAY"
                        },
                        {
                            "id": 3,
                            "name": "TUESDAY"
                        },
                        {
                            "id": 4,
                            "name": "WEDNESDAY"
                        }
                    ],
                    "value": {
                        "quantity": 2
                    }
                }
            ]
        },
        {
            "id": 151,
            "rule": {
                "id": 23,
                "qualifier": "ERULE_MAX_DAYS_WK"
            },
            "effectiveDate": "2020-02-10",
            "expirationDate": "2020-02-28",
            "overrideDetails": [
                {
                    "ruleParameterType": {
                        "id": 2,
                        "qualifier": "ERPARAM_SCHED_DAYS"
                    },
                    "value": {
                        "quantity": 3
                    }
                }
            ]
        }
    ]
}

Delete an assignment

To delete a schedule rule override assignment associated with a person, call DELETE /v1/commons/persons/schedule_rule_overrides/{schedule_rule_override_id} with the following request payload. In this example, call DELETE /v1/commons/persons/schedule_rule_overrides/151 to remove the maximum of 3 days per week scheduling restriction.

The system returns HTTP status 204 with no response body. The delete operation can be confirmed by following the verification procedure.