Symptom
The following error is seen in the response of an EmployeeTime upsert request via OData API:
- “An entry is already recorded on calendar for period dd/mm/yyyy - dd/mm/yyyy. To edit, please click on the date mentioned on the Calendar.”
NOTE: Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.
Cause
Since you're performing retroactive changed to a calendar, the system presumes you're trying to edit an existing EmployeeTime record. To edit an EmployeeTime record, you must provide its externalCode in the payload.
Therefore, here are some possible scenarios which could be causing the error:
Scenario 1
The EmployeeTime record is being upserted with a new externalCode, which does not correspond to any existing record (you can double check that under 'Manage Data' and search for the Employee Time record with the externalCode from the upsert payload):
Taking as example the following upsert request:
{
"__metadata": {
"uri": "https://api5.successfactors.eu/odata/v2/EmployeeTime",
"type": "SFOData.EmployeeTime"
},
"startDate": "/Date(1602633600000)/",
"endDate": "/Date(1602633600000)/",
"externalCode": "XYZ123456",
"userId": "12345678",
"timeType": "REG"
}
Scenario 2
You're upserting the record without providing any externalCode in the request payload, so the system
{
"__metadata": {
"uri": "https://api5.successfactors.eu/odata/v2/EmployeeTime",
"type": "SFOData.EmployeeTime"
},
"startDate": "/Date(1602633600000)/",
"endDate": "/Date(1602633600000)/",
"userId": "12345678",
"timeType": "REG"
}
In both cases, the system will interpret the request as an INSERT rather than an UPDATE operation, and will throw the error because there's already an existing EmployeeTime record for the given period, so a new one cannot be inserted. Therefore, the upsert will fail with the given error message.
Resolution
When editing an existing EmployeeTime record, provide its externalCode in the request payload, or else the system will try to insert a new record and fail due to the reasons explained in the section above.
Keywords
http, code, 500, leave of absence, loa, request, import, update, insert, failed, failure, fails, not successful, Odata, api, integration, interface, flow, call, query, upsert, get, post, payload, response , KBA , LOD-SF-INT-EC , Employee Central SFAPI & OData Entities , LOD-SF-INT , Integrations , LOD-SF-INT-ODATA , OData API Framework , Problem