Symptom
The error below occurs when attempting to create an EmployeeTime record via OData API:
"Sorry, you can’t edit employee times outside of the designated access period. You might also lack the necessary permissions. with the index 0".
No errors occur when importing the exact same data through the import tool, though.
Environment
Employee Central OData API
Reproducing the Issue
- Run the API Upsert in EmployeeTime entity.
- The error message is displayed.
However, no errors occur in import when following these steps:
- Proxy to the API user.
- Go to the import tool (Import and Export Data), select Import and select "EmployeeTime" object.
- Build a CSV file containing the same data being sent in the Upsert and use it in the import tool.
- No errors occur and data is properly imported.
Cause
The issue arises because the API user lacks the necessary permissions to edit the EmployeeTime object.
On UI you'll also see the same error when proxying as the API user and trying to create the time off record.
The API user is able to import without any issues because it may have proper permissions for importing, and during import the blocking period validations are skipped.
Resolution
Identify the user's Role-Based Permissions (RBP) and provide the Edit permission for the "EmployeeTime" object under "Time Management Object Permissions".
See Also
Keywords
OData API, time off, EmployeeTime, permissions, Upsert, , KBA , LOD-SF-INT-EC , Employee Central SFAPI & OData Entities , Problem