ConnectScheduling / Client / approve_time_off

approve_time_off

ConnectScheduling.Client.approve_time_off(**kwargs)

Approves a time off request. Evaluates agent time off balances and group time off allowances before approving. RuleFailureAction controls what happens when these evaluations fail. The request is rejected with CONFLICTING_TIME_OFF_REQUEST if it overlaps another time off request for the user that is APPROVED or being approved.

The time off request is processed asynchronously, so a successful call doesn’t indicate the final status. Read the resulting status with GetTimeOff or from the time off state-change events.

Approving an APPROVED request succeeds without a change. Approving a REJECTED request evaluates the rules again, so it can end APPROVED or REJECTED, and repeating the call can give a different result. Check the status with GetTimeOff before you retry.

Returns ConflictException if the request is PENDING or CANCELLED. PENDING means Connect Customer is still processing the request asynchronously. Wait until GetTimeOff returns a status other than PENDING, and then retry.

Warning

When the approval succeeds, Connect Customer cancels any overtime or voluntary time off activity that overlaps the approved window.

Note

Connect Customer doesn’t check whether the principal that calls this operation supervises the user. The staffing group’s approval settings also don’t apply. IAM permissions are the only control. If you allow a principal to call this operation, that principal can send RuleFailureAction OVERRIDE and approve a request past failed rules. Grant permission for this operation only to principals that you trust to override time off rules.

See also: AWS API Documentation

Request Syntax

response = client.approve_time_off(
    InstanceId='string',
    UserId='string',
    TimeOffId='string',
    Description='string',
    RuleFailureAction='REJECT'|'OVERRIDE'
)
Parameters:
  • InstanceId (string) –

    [REQUIRED]

    The identifier of the Connect Customer instance. This can be the ID or the ARN of the instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

  • UserId (string) –

    [REQUIRED]

    The identifier of the user who the time off request belongs to. This can be the ID or the ARN of the user.

  • TimeOffId (string) –

    [REQUIRED]

    The unique identifier of the time off request to approve. If the time off request doesn’t belong to UserId, the operation returns ResourceNotFoundException.

  • Description (string) – A description recorded with the approval. GetTimeOff doesn’t return it.

  • RuleFailureAction (string) – Controls what happens when a configured rule fails. REJECT, the default, records an ERROR and leaves the request REJECTED. OVERRIDE records a WARNING and approves the request, like the Override time off rules option in the Connect Customer admin website. OVERRIDE never waives CONFLICTING_TIME_OFF_REQUEST.

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

    The response for ApproveTimeOff.

Exceptions

  • ConnectScheduling.Client.exceptions.InternalServerException

  • ConnectScheduling.Client.exceptions.ValidationException

  • ConnectScheduling.Client.exceptions.ThrottlingException

  • ConnectScheduling.Client.exceptions.AccessDeniedException

  • ConnectScheduling.Client.exceptions.ConflictException

  • ConnectScheduling.Client.exceptions.ResourceNotFoundException