LeaveApplications
Manages leave applications submitted by employees. It allows for querying, inserting, and updating leave requests for various types of employee leave.
Table Specific Information
The Timesheets table allows you to SELECT and INSERT leave applications for a Xero organization. The Id column is generated by the cmdlet; the value of this field combines the index of the line item with the unique, Xero-generated LeaveApplicationID.
SELECT
The Xero API allows extensive filtering and ordering. You can define WHERE and ORDER BY clauses in a query to filter and order the results using any non-line-item column.
Note: The Xero API does not support filtering on line items or journal lines.
INSERT
To insert a single row, set the required fields. A new table object is created as a single entry. To insert a new leave application, the EmployeeID, LeaveTypeID, Title, StartDate and EndDate are required. In addition leave periods may also be provided.
In addition to inserting a single row, line item tables offer two additional ways to insert into a table.
- You can insert a new object with multiple line items using XML aggregates.
The elements supported here are the same as the Line columns with the LeavePeriods_LeavePeriod_ prefix removed.
INSERT INTO LeaveApplications (EmployeeID, LeaveTypeID, Title, StartDate, EndDate, LeavePeriodAggregate) VALUES ( 'XXXXX-XXXXX-XXXXX-XXXXX', 'YYYYY-YYYYY-YYYYY-YYYYY', 'Visit relatives', '2021-01-01', '2021-01-07', '<LeavePeriod> <NumberOfUnits>8</NumberOfUnits> </LeavePeriod> <LeavePeriod> <NumberOfUnits>32</NumberOfUnits> </LeavePeriod>' )
- You can insert a new period on an existing object by specifying the Xero-generated identifier of the existing record. For example, to add a period to an existing leave application:
INSERT INTO LeaveApplications (LeaveApplicationID, LeavePeriods_LeavePeriod_NumberOfUnits) VALUES ('XXXXX-XXXXX-XXXXX-XXXXX', 'YYYYY-YYYYY-YYYYY-YYYYY', 32)
Note: Inserting into existing records will count as two operations against the Xero API. One is required to retrieve the existing record, and another to update the record with new data.
UPDATE
You can update any field that is not read-only.
Note: UPDATE operations will count as two operations against the Xero API. One is required to retrieve the existing record, and another to update the record with new data.
DELETE
The Xero API has limited support for deleting any object. In order to delete objects, you must update their Status to an appropriate value.
Applicable values for this field may be state-dependent. For example, invoices can only have their status set to DELETED when the invoice status is currently DRAFT or SUBMITTED.
Columns
| Name | Type | ReadOnly | Filterable | Description |
| Id [KEY] | String | True |
A unique combination of the leave period line-item index and the Xero-generated identifier for the leave application. | |
| LeaveApplicationID | String | True |
The unique identifier assigned to the leave application by Xero, linking multiple leave periods to a single application. | |
| EmployeeID | String | False |
The unique Xero identifier for the employee requesting the leave. | |
| LeaveTypeID | String | False |
The unique Xero identifier for the type of leave, such as sick leave or annual leave. | |
| Title | String | False |
The brief title or label for the leave period, for example, 'Vacation' or 'Sick Leave'. | |
| StartDate | String | False |
The start date of the leave, formatted as YYYY-MM-DD. | |
| EndDate | String | False |
The end date of the leave, formatted as YYYY-MM-DD. | |
| Description | String | False |
A free-text description explaining the reason for taking the leave (for example, 'Family Emergency' or 'Annual Leave'). | |
| LeavePeriodAggregate | String | False |
Used to define leave period rows in XML format. Should only be provided when inserting new records. | |
| LeavePeriods_LeavePeriod_PayPeriodStartDate | String | False |
The start date of the pay period from which the leave is being drawn. | |
| LeavePeriods_LeavePeriod_PayPeriodEndDate | String | False |
The end date of the pay period from which the leave is being drawn. | |
| LeavePeriods_LeavePeriod_LeavePeriodStatus | String | False |
The current status of the leave period, either 'SCHEDULED' (pending) or 'PROCESSED' (completed). | |
| LeavePeriods_LeavePeriod_NumberOfUnits | String | False |
The number of leave units (for example, days or hours) consumed during the specified pay period. | |
| TenantId | String | False |
The unique ID of the tenant (organization) to query instead of the connection tenant. |