Schedule Rule Override Assignments - Aggregated

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

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 or update assignments

The create or update 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"
  },
  "personAssignments": {
    "scheduleRuleOverrides": {
      "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"
    },
    "personAssignments": {
      "scheduleRuleOverrides": {
        "overrideRules": [
          {
            "id": 2,
            "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
                }
              }
            ]
          },
          {
            "id": 1,
            "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": 4,
                    "name": "WEDNESDAY"
                  },
                  {
                    "id": 3,
                    "name": "TUESDAY"
                  },
                  {
                    "id": 2,
                    "name": "MONDAY"
                  }
                ],
                "value": {
                  "quantity": 2
                }
              }
            ]
          }
        ]
      }
    }
  }
]

Verify assignments

You can use the bulk multi-read operation to verify assignments for multiple people at once.

Example request

To verify, call POST /v1/commons/persons/assignments/multi_read with the following request payload.

{
  "where": {
    "employees": {
      "key": "personNumber",
      "values": [
        "20190"
      ]
    },
    "personAssignments": [
      "scheduleRuleOverrides"
    ]
  }
}

Example response

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

[
  {
    "personIdentity": {
      "personNumber": "20190"
    },
    "personAssignments": {
      "scheduleRuleOverrides": {
        "overrideRules": [
          {
            "id": 1,
            "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": 4,
                    "name": "WEDNESDAY"
                  },
                  {
                    "id": 3,
                    "name": "TUESDAY"
                  },
                  {
                    "id": 2,
                    "name": "MONDAY"
                  }
                ],
                "value": {
                  "quantity": 2
                }
              }
            ]
          },
          {
            "id": 2,
            "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 assignments

You can delete, or unassign, schedule rule overrides assignments. To delete our example's assignments, call POST /v1/commons/persons/assignments/multi_upsert using the unAssignExisting property.

Example request

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

[
    {
        "personIdentity": {
            "personNumber": "20190"
        },
        "personAssignments": {
            "scheduleRuleOverrides": {
                "unAssignExisting":true
            }
        }
    }
]

Example response

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

[
  {
    "personIdentity": {
      "personNumber": "20190"
    },
    "personAssignments": {
      "scheduleRuleOverrides": {
        "overrideRules": []
      }
    }
  }
]

Note: You can verify that the assignments were deleted by calling POST /v1/commons/persons/assignments/multi_read with a request payload specifying all of the affected person identities.