--- title: "sprAbsences" slug: "sprabsences" updated: 2026-06-30T11:28:26Z published: 2026-06-30T11:28:26Z canonical: "instrukcijos.softera.lt/sprabsences" --- > ## Documentation Index > Fetch the complete documentation index at: https://instrukcijos.softera.lt/llms.txt > Use this file to discover all available pages before exploring further. # sprAbsences Represents an absence entry for an employee — including standard leave, sick leave, and business trips. ## Base URL ``` https://api.businesscentral.dynamics.com/v2.0/{tenantId}/{environmentName}/api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences ``` ## Supported operations | Operation | HTTP method | Endpoint | Description | | --- | --- | --- | --- | | List | GET | `/sprAbsences` | Returns a collection of absence entries. | | Get | GET | `/sprAbsences({id})` | Returns a single absence entry by its system ID. | | Create | POST | `/sprAbsences` | Creates a new absence entry. | | Update | PATCH | `/sprAbsences({id})` | Updates an existing absence entry. | | Delete | DELETE | `/sprAbsences({id})` | Deletes an absence entry. | | cancelAbsence | POST | `/sprAbsences({id})/Microsoft.NAV.cancelAbsence` | Changes the absence status to `Cancelled`. | | approveAbsence | POST | `/sprAbsences({id})/Microsoft.NAV.approveAbsence` | Changes the absence status to `Approved`. | | reopenAbsence | POST | `/sprAbsences({id})/Microsoft.NAV.reopenAbsence` | Changes the absence status to `Open`. | ## Properties | Property | Type | Writable | Description | | --- | --- | --- | --- | | `id` | Guid | No | System-generated unique identifier (OData key). | | `entryNumber` | Integer | No | Sequential entry number assigned by the system. | | `status` | String | No | Current workflow status: `Open`, `Approved`, or `Cancelled`. Changed via bound actions only. See Remarks for the effect of each status on payroll calculation and editability. | | `employeeId` | Guid | Yes | System ID of the employee. Use `employeeId` **or** `employeeNumber` when creating. | | `employeeNumber` | String | Yes | Employee number. Use `employeeId` **or** `employeeNumber` when creating. Required (`ShowMandatory`). | | `activityId` | Guid | Yes | System ID of the activity (absence type). Use `activityId` **or** `activityCode`. | | `activityCode` | String | Yes | Code of the activity (absence type). Use `activityId` **or** `activityCode`. | | `startDate` | Date | Yes | First day of the absence (inclusive). | | `endDate` | Date | Yes | Last day of the absence (inclusive). | | `contractSeqId` | Guid | Yes | System ID of the employee's contract sequence. | | `contractSeqNumber` | Integer | Yes | Sequential number of the employee's contract. | | `extensionOfAbsenceId` | Guid | Yes | System ID of the parent absence entry this entry extends. `00000000-0000-0000-0000-000000000000` if not an extension. | | `extensionOfAbsenceNumber` | Integer | Yes | Entry number of the parent absence entry. `0` if not an extension. | | `sickNotePostDate` | Date | Yes | Date the sick note (medical certificate) was registered. `0001-01-01` if not applicable. | | `busTripLocationCode` | String | Yes | Business-trip destination location code. Empty if not a business trip. | | `busTripLocationId` | Guid | Yes | System ID of the business-trip destination location. | | `busTripTown` | String | Yes | Free-text destination town for a business trip. | | `busTripAimCode` | String | Yes | Business-trip purpose/aim code. | | `busTripAimId` | Guid | Yes | System ID of the business-trip aim. `00000000-0000-0000-0000-000000000000` if not applicable. | | `busTripDailyRate` | Decimal | Yes | Daily reimbursement rate for the business trip. | | `busTripDailyAllowance` | Decimal | Yes | Daily allowance amount for the business trip. | | `substituteWorkerNo` | String | Yes | Employee number of the substitute worker during the absence. | | `expectedPaymentDate` | Date | Yes | Date on which the absence payment is expected. `0001-01-01` if not specified. | | `paymentPreference` | String | Yes | Payment preference option code. | | `lastModifiedDateTime` | DateTimeOffset | No | UTC timestamp of the last modification (system-managed). | ## Relationships / navigation properties | Navigation property | Entity | Entity set | Link | | --- | --- | --- | --- | | `sprDimensionSetLines` | `sprDimensionSetLine` | `sprDimensionSetLines` | Dimension set lines for the absence entry. Linked by `Parent Id = id` and `Parent Type = Absence`. | | `sprBusinessTripLocations` | `sprBusinessTripLocation` | `sprBusinessTripLocations` | Business-trip location master data. Linked by `SystemId = busTripLocationId`. | | `sprBusinessTripAims` | `sprBusinessTripAim` | `sprBusinessTripAims` | Business-trip aim/purpose master data. Linked by `SystemId = busTripAimId`. | Expand navigation properties using `$expand`: ``` $expand=sprDimensionSetLines,sprBusinessTripAims,sprBusinessTripLocations ``` ## Remarks - **Employee identification on create:** Supply either `employeeId` (GUID) or `employeeNumber` (string), not both. The Postman collection shows both fields in examples; the server resolves them in order, so supplying both is safe but redundant. - **Activity identification on create:** Similarly, supply either `activityId` or `activityCode`. - **Absence status lifecycle:** | Status | Included in payroll calculation | Editability | | --- | --- | --- | | `Open` | No | Writable — the record can be updated via PATCH and deleted. | | `Approved` | Yes | Read-only — PATCH and DELETE are rejected. Use `reopenAbsence` to return the record to `Open` before editing. | | `Cancelled` | No | Read-only — the record cannot be edited or deleted. | The `status` field is read-only via properties. Use the bound actions `approveAbsence`, `reopenAbsence`, and `cancelAbsence` to transition between statuses. Bound actions require no request body. **Side-effects of `approveAbsence`:** **Side-effects of `cancelAbsence`:** - The system validates that no overlapping approved absence already exists for the employee in the same date range. The request fails if an overlap is detected. - All Time Sheet entries for the employee that fall within the absence period are deleted and replaced with entries carrying the absence `activityCode`. - The absence-generated Time Sheet entries are removed and automatically rebuilt from the employee's Work Schedule entries for the affected period. - **`If-Match` header:** Required for PATCH and DELETE to prevent mid-air collisions. Use the `@odata.etag` value returned from a prior GET. - **Business-trip fields:** `busTripLocationCode`, `busTripLocationId`, `busTripTown`, `busTripAimCode`, `busTripAimId`, `busTripDailyRate`, and `busTripDailyAllowance` are only meaningful when the `activityCode` represents a business trip type. Leave them empty/zero for regular absences. - **Date sentinel values:** `0001-01-01` indicates "not set" for `sickNotePostDate`, `expectedPaymentDate`, and similar date fields. - **`paymentPreference`:** The observed response value `"_x0020_"` is the OData/XML encoding for a space character (`0x20`), indicating an empty or default option. - **`extensionOfAbsenceId` / `extensionOfAbsenceNumber`:** Use these to link a continuation/extension absence to its parent. Leave as `00000000-0000-0000-0000-000000000000` / `0` for standalone absences. - **Postman PATCH example note:** The Postman collection's PATCH example body contains fields `code`, `description`, and `employeeProfessionCode`, which do not belong to the `sprAbsences` resource. Those appear to be copy-pasted from another endpoint. Use only the fields listed in the Properties table above. - **`approveAbsence` and `reopenAbsence` actions:** Defined in the AL page (`[ServiceEnabled]`) but not present in the Postman collection. The URL pattern follows the same convention as `cancelAbsence`. ## Example requests ### List all absences ``` GET /api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences?$orderby=employeeNumber desc ``` ### List absences for a specific employee (by employee number) ``` GET /api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences?$filter=employeeNumber eq {employeeNumber}&$expand=sprDimensionSetLines,sprBusinessTripAims,sprBusinessTripLocations&$orderby=employeeNumber desc ``` ### List absences for a specific employee (by employee ID) ``` GET /api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences?$filter=employeeId eq {employeeId}&$expand=sprDimensionSetLines,sprBusinessTripAims,sprBusinessTripLocations ``` ### Get a single absence ``` GET /api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences({id}) ``` **Response `200 OK`:** ``` { "@odata.context": "https://{hostname}/BC/api/softera/softeraPayroll/v1.0/$metadata#companies({companyId})/sprAbsences/$entity", "@odata.etag": "W/\"JzE5OzU1NTQwMDY2NDAxMTczMDk2NDYxOzAwOyc=\"", "id": "6483af42-5e8a-f011-9ad6-8a897ed1164d", "entryNumber": 61, "status": "Open", "employeeId": "73edac60-178a-f011-9ad6-dbdb56af8873", "employeeNumber": "D0001", "activityId": "e5785c80-b3d1-ef11-84d7-8a77f420822c", "activityCode": "A", "startDate": "2025-12-15", "endDate": "2025-12-19", "contractSeqId": "8bedac60-178a-f011-9ad6-dbdb56af8873", "contractSeqNumber": 1, "extensionOfAbsenceId": "00000000-0000-0000-0000-000000000000", "extensionOfAbsenceNumber": 0, "sickNotePostDate": "0001-01-01", "busTripLocationCode": "AE", "busTripLocationId": "c31e8daa-b3d1-ef11-84d7-8a77f420822c", "busTripTown": "", "busTripAimCode": "", "busTripAimId": "00000000-0000-0000-0000-000000000000", "busTripDailyRate": 60, "busTripDailyAllowance": 999, "substituteWorkerNo": "", "expectedPaymentDate": "0001-01-01", "paymentPreference": "_x0020_", "lastModifiedDateTime": "2025-10-23T10:55:35.493Z" } ``` ### Create an absence (minimal) ``` POST /api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences Content-Type: application/json ``` ``` { "employeeId": "{employeeId}", "activityCode": "A", "startDate": "2026-06-10", "endDate": "2026-06-20" } ``` ### Create a business-trip absence (full body) ``` POST /api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences Content-Type: application/json ``` ``` { "employeeId": "{employeeId}", "employeeNumber": "D0001", "activityCode": "K", "startDate": "2026-06-10", "endDate": "2026-06-20", "sickNotePostDate": "0001-01-01", "busTripLocationCode": "AE", "busTripTown": "Vilnius", "busTripAimCode": "CONF", "busTripDailyRate": 60, "busTripDailyAllowance": 999 } ``` **Response `201 Created`** — returns the created absence object (same shape as Get response). ### Update an absence ``` PATCH /api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences({id}) Content-Type: application/json If-Match: W/"..." ``` ``` { "endDate": "2026-06-25", "substituteWorkerNo": "D0001" } ``` **Response `200 OK`** — returns the updated absence object. ### Delete an absence ``` DELETE /api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences({id}) If-Match: W/"..." ``` **Response `204 No Content`** ### Cancel an absence (bound action) ``` POST /api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences({id})/Microsoft.NAV.cancelAbsence ``` **Response `200 OK`** — returns the updated absence object with `status: "Cancelled"`. ### Approve an absence (bound action) ``` POST /api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences({id})/Microsoft.NAV.approveAbsence ``` **Response `200 OK`** — returns the updated absence object with `status: "Approved"`. ### Reopen an absence (bound action) ``` POST /api/softera/softeraPayroll/v1.0/companies({companyId})/sprAbsences({id})/Microsoft.NAV.reopenAbsence ``` **Response `200 OK`** — returns the updated absence object with `status: "Open"`.