Schedule Rule Set Assignments - Aggregated

Schedule rule sets contain the restrictions and requirements that ensure a schedule meets certain criteria and include employee and organizational rules.

Prerequisites

A person ID is the same identifier as personKey and employee ID, and is not the same as a person number.

Example

In this example, we assign, verify, delete, and pass a request that makes no change to multiple people's schedule rule set assignments.

Create or update assignments

The create or update request:

  • uses personIdentity to identify the person using their person number
  • uses scheduleRuleSet inside personAssignments to define the schedule rule sets to assign

Example request

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

[
    {
        "personIdentity": {
            "personNumber": "10030"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "scheduleRuleSetAssignments": [
                    {
                        "ruleSet": {
                            "id": 5,
                            "qualifier": "Full Time Emp Rule Set"
                        },
                        "context": {
                            "id": -1,
                            "qualifier": "DEFAULT"
                        },
                        "effectiveDate": "2020-02-20",
                        "expirationDate": "3000-01-01"
                    }
                ]
            }
        }
    },
    {
        "personIdentity": {
            "personNumber": "10032"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "scheduleRuleSetAssignments": [
                    {
                        "ruleSet": {
                            "id": 5,
                            "qualifier": "Full Time Emp Rule Set"
                        },
                        "context": {
                            "id": -1,
                            "qualifier": "DEFAULT"
                        },
                        "effectiveDate": "2020-02-25",
                        "expirationDate": "3000-01-01"
                    }
                ]
            }
        }
    }
]

Example response

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

[
    {
        "personIdentity": {
            "personNumber": "10030"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "scheduleRuleSetAssignments": [
                    {
                        "ruleSet": {
                            "id": 5,
                            "qualifier": "Half Year Period - Rolling"
                        },
                        "context": {
                            "id": -1,
                            "qualifier": "DEFAULT"
                        },
                        "effectiveDate": "2020-02-20",
                        "expirationDate": "3000-01-01"
                    }
                ]
            }
        }
    },
    {
        "personIdentity": {
            "personNumber": "10032"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "scheduleRuleSetAssignments": [
                    {
                        "ruleSet": {
                            "id": 5,
                            "qualifier": "Half Year Period - Rolling"
                        },
                        "context": {
                            "id": -1,
                            "qualifier": "DEFAULT"
                        },
                        "effectiveDate": "2020-02-25",
                        "expirationDate": "3000-01-01"
                    }
                ]
            }
        }
    }
]

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": [
        "10032","10030"
      ]
    },
    "personAssignments": [
    "scheduleRuleSet"
    ]
  }
}

Example response

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

[
    {
        "personIdentity": {
            "personNumber": "10032"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "scheduleRuleSetAssignments": [
                    {
                        "ruleSet": {
                            "id": 5,
                            "qualifier": "Half Year Period - Rolling"
                        },
                        "context": {
                            "id": -1,
                            "qualifier": "DEFAULT"
                        },
                        "effectiveDate": "2020-02-25",
                        "expirationDate": "3000-01-01"
                    }
                ]
            }
        }
    },
    {
        "personIdentity": {
            "personNumber": "10030"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "scheduleRuleSetAssignments": [
                    {
                        "ruleSet": {
                            "id": 5,
                            "qualifier": "Half Year Period - Rolling"
                        },
                        "context": {
                            "id": -1,
                            "qualifier": "DEFAULT"
                        },
                        "effectiveDate": "2020-02-20",
                        "expirationDate": "3000-01-01"
                    }
                ]
            }
        }
    }
]

Make no change to assignments

When working with large numbers of people, you may wish to pass a request payload that makes no changes to a person's schedule rule set assignments.

In the following example, the system makes no changes. Setting a null assignmentProfile and passing the unAssignExisting Boolean as false both result in no changes to a person's assignments.

Example request

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

[
    {
        "personIdentity": {
            "personNumber": "10020"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "scheduleRuleSetAssignments":null
            }
        }
    },
    {
        "personIdentity": {
            "personNumber": "10030"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "unAssignExisting":false
            }
        }
    }
]

Example response

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

[
    {
        "personIdentity": {
            "personNumber": "10020"
        },
        "personAssignments": {
            "scheduleRuleSet": {}
        }
    },
    {
        "personIdentity": {
            "personNumber": "10030"
        },
        "personAssignments": {
            "scheduleRuleSet": {}
        }
    }
]

Delete assignments

You can delete, or unassign, schedule rule set assignments. To delete our example's schedule rule set 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": "10020"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "unAssignExisting":true
            }
        }
    },
    {
        "personIdentity": {
            "personNumber": "10030"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "unAssignExisting":true
            }
        }
    }
]

Example response

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

[
    {
        "personIdentity": {
            "personNumber": "10020"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "scheduleRuleSetAssignments": []
            }
        }
    },
    {
        "personIdentity": {
            "personNumber": "10030"
        },
        "personAssignments": {
            "scheduleRuleSet": {
                "scheduleRuleSetAssignments": []
            }
        }
    }
]

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.