Represents contracts (spr) in Business Central.
Methods
Method | Return Type | Description |
---|---|---|
GET sprContracts | sprContracts | Gets a contract object. |
DELETE sprContracts | none | Deletes a contract object. |
POST sprContracts | sprContracts | Creates a contract object. |
PATCH sprContracts | sprContracts | Updates a contract object. |
Bound Actions
The contract resource type offers bound actions:
newUsingCurrent
which creates a new contract using the current contract data. This is illustrated in the following example:POST ..companies({id})/sprContracts({id})/Microsoft.NAV.newUsingCurrent
The response contains the new contract ID.
Navigation
Navigation | Return Type | Description |
---|---|---|
sprEmployee | sprEmployee | Gets the employee associated with the contract. |
sprAllocations | Collection(sprAllocation) | Gets the allocations associated with the contract. |
Properties
Property | Type | Description | Relation to |
---|---|---|---|
id | Guid | Specifies the contract's ID. Non-editable. | |
employeeNumber | String[20] | Specifies the employee's number. | sprEmployees.number |
employeeId | Guid | Specifies the employee's id. | sprEmployees.id |
number | String[20] | Specifies the contract's number. | |
extendsContractNo | String[20] | Specifies the extended contract's number. | sprContracts.number |
externalContractNo | String[20] | Specifies the external contract's number. | sprContracts.number |
mainContract | Boolean | Specifies if this is the main contract. | |
startDate | Date | Specifies the contract's start date. | |
endDate | Date | Specifies the contract's end date. | |
contractType | Option | Specifies the contract type. It can be: 0- " " 1- Open-Ended 2- Fixed-Term 3- Temporary 4- Apprenticeship 5- Undetermined Volume 6- Project Based 7- Job-Sharing 8- With Several Employers 9- Seasonal |
|
signDate | Date | Specifies the contract's sign date. | |
probationPeriodFrom | Date | Specifies the probation period's start date. | |
probationPeriod | String | Specifies the probation period's duration. | |
probationPeriodUntil | Date | Specifies the probation period's end date. | |
lastModifiedDateTime | DateTimeOffset | Specifies the contract's last modified date. Read-Only. |
Examples
Create sprContracts
POST URI: /companies({{companyId}})/sprContracts
Request
{
"employeeId": "{{employeeId}}",
"extendsContractNo": "",
"startDate": "2023-05-01",
"endDate": "0001-01-01",
"contractType": "Open-Ended",
"signDate": "2023-05-01",
"probationPeriodFrom": "2023-05-01",
"probationPeriod": "3M"
}
Response
{
"@odata.context": "http://bc220-2:7048/BC/api/softera/softeraPayroll/v1.0/$metadata#companies(fb9142f3-361f-ee11-a396-ce5b49aea574)/sprContracts/$entity",
"@odata.etag": "W/\"JzE4Ozk3Mjg0MjA1NjgyNTAzNTQ0NzE7MDA7Jw==\"",
"id": "241c4822-1027-ee11-a395-fe66e2afdfa9",
"employeeNumber": "D0005",
"employeeId": "afc1762f-f826-ee11-a395-fe66e2afdfa9",
"number": "S0005",
"extendsContractNo": "",
"externalContractNo": "S0005",
"mainContract": true,
"startDate": "2023-05-01",
"endDate": "0001-01-01",
"contractType": "Open-Ended",
"signDate": "2023-05-01",
"probationPeriodFrom": "2023-05-01",
"probationPeriod": "3M",
"probationPeriodUntil": "2023-07-31",
"lastModifiedDateTime": "2023-07-20T15:14:35.33Z"
}
Create sprContracts and sprAllocations at once
POST URI: /companies({{companyId}})/sprContracts?$expand=sprAllocations
Request
{
"employeeId": "{{employeeId}}",
"startDate": "2023-05-01",
"contractType": "Open-Ended",
"signDate": "2023-05-01",
"probationPeriodFrom": "2023-05-01",
"probationPeriod": "3M",
"sprAllocations": [
{
"startDate": "2023-05-01",
"positionId": "{{positionId}}",
"emplPostGroupId": "{{employeePostingGroupId}}",
"workScheduleFormulaId": "{{workScheduleFormulaId}}",
"staff": 1,
"vacationScheme": 20,
"tEAType": "Apply",
"skipSPRAllocationSalaryAutoCreation": false
}
]
}
Response
{
"@odata.context": "http://bc220-2:7048/BC/api/softera/softeraPayroll/v1.0/$metadata#companies(fb9142f3-361f-ee11-a396-ce5b49aea574)/sprContracts/$entity",
"@odata.etag": "W/\"JzIwOzEyNDc2MzQ4Njc4NDEyOTg1OTQ2MTswMDsn\"",
"id": "15d80d41-bc2b-ee11-a395-98edeed05568",
"employeeNumber": "D0019",
"employeeId": "a102cb47-1e27-ee11-a395-fe66e2afdfa9",
"number": "S0019",
"extendsContractNo": "",
"externalContractNo": "S0019",
"mainContract": false,
"startDate": "2023-05-01",
"endDate": "0001-01-01",
"contractType": "Open-Ended",
"signDate": "2023-05-01",
"probationPeriodFrom": "2023-05-01",
"probationPeriod": "3M",
"probationPeriodUntil": "2023-07-31",
"lastModifiedDateTime": "2023-07-26T13:56:45.053Z",
"sprAllocations": [
{
"@odata.etag": "W/\"JzE5OzE3NDQxMDU1NDQyMTE5MzIxNDIxOzAwOyc=\"",
"id": "17d80d41-bc2b-ee11-a395-98edeed05568",
"previousAllocationId": "00000000-0000-0000-0000-000000000000",
"employeeId": "a102cb47-1e27-ee11-a395-fe66e2afdfa9",
"employeeNumber": "D0019",
"contractId": "15d80d41-bc2b-ee11-a395-98edeed05568",
"contractNumber": "S0019",
"number": 29,
"lastContractSeqAllocation": true,
"startDate": "2023-05-01",
"endDate": "0001-01-01",
"positionId": "3e2bbeaf-381f-ee11-a396-ce5b49aea574",
"positionCode": "DARB01",
"positionDescription": "Darbuotojas 01",
"emplPostGroupId": "aa640e59-381f-ee11-a396-ce5b49aea574",
"emplPostGroupCode": "DARB",
"workScheduleFormulaId": "13650e59-381f-ee11-a396-ce5b49aea574",
"wScheduleFormulaCode": "A5",
"staff": 1,
"vacationScheme": 20,
"pensionAccumMethod": " ",
"tEAType": "Apply",
"orderNo": "",
"managerNo": "",
"managerId": "00000000-0000-0000-0000-000000000000",
"workCountryCode": "",
"workPostCode": "",
"workCity": "",
"workAddress": "",
"workAddress2": "",
"skipSPRAllocationSalaryAutoCreation": false,
"lastModifiedDateTime": "2023-07-26T13:56:45.123Z"
}
]
}
Create sprContracts bounded with newUsingCurrent
POST URI: /companies({{companyId}})/sprContracts({{contractId}})/Microsoft.NAV.newUsingCurrent
Request
{
"newDate" : "2023-08-10"
}
Response
{
"@odata.context": "http://bc220-2:7048/BC/api/softera/softeraPayroll/v1.0/$metadata#Edm.Guid",
"value": "e118ea00-932b-ee11-a395-fe66e2afdfa9"
}