LeaveApplications
Query, insert and update Leave Applications for a Xero organisation.
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 driver; 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
Inserting a single row is straightforward, even with line item tables. Simply set the required fields and a new table object will be 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 |
The leave period line-item combined with the unique Xero identifier of the leave application. | |
LeaveApplicationID | String | True |
The unique identifier of the Leave Application. This field is assigned by Xero. | |
EmployeeID | String | False |
The Xero identifier for Payroll Employee. | |
LeaveTypeID | String | False |
The Xero identifier for Leave Type. | |
Title | String | False |
The title of the leave (max length = 50). | |
StartDate | String | False |
Start date of the leave (YYYY-MM-DD). | |
EndDate | String | False |
End date of the leave (YYYY-MM-DD). | |
Description | String | False |
The Description of the Leave (max length = 200). | |
LeavePeriodAggregate | String | False |
Used to define LeavePeriod rows using XML values. Should be provided on INSERT only. | |
LeavePeriods_LeavePeriod_PayPeriodStartDate | String | False |
The start of the payperiod the leave is being drawn from | |
LeavePeriods_LeavePeriod_PayPeriodEndDate | String | False |
The end of the payperiod the leave is being drawn from | |
LeavePeriods_LeavePeriod_LeavePeriodStatus | String | False |
Either SCHEDULED or PROCESSED | |
LeavePeriods_LeavePeriod_NumberOfUnits | String | False |
Amount of leave consumed from this payperiod | |
TenantId | String | False |
The ID of the tenant to query instead of the connection tenant |