Symptom
OData API Call to convertAssignmentIdExternal failing with error "java.lang.Integer cannot be cast to java.lang.String".
Environment
SAP SuccessFactors HCM
- OData API
Reproducing the Issue
In this example we will be using Postman to do API call.
Testing 1:Request payload:
https://apisalesdemo4.successfactors.com/odata/v2/convertAssignmentIdExternal?oldAssignmentIdExternal=britney&newAssignmentIdExternal=test1234
- Response Payload:
{
"d": {
"convertAssignmentIdExternal": "test123"
}
}
Testing 2:Request payload:
https://apisalesdemo4.successfactors.com/odata/v2/convertAssignmentIdExternal?oldAssignmentIdExternal=jonsnow&newAssignmentIdExternal=1234&$format=json
- Response payload:
"error": {
"code": "ServerErrorException",
"message": {
"lang": "en-US",
"value": "java.lang.Integer cannot be cast to java.lang.String"
Cause
The values for AssignmentIdExternal could not be pure numeric values or values that start with numbers in the API request query, but with single quote will always work.
Resolution
If the value starts with numeric, use single quote in the API URL.
See Also
2825052 - Assignment ID
Keywords
convertAssignmentIdExternal ServerErrorException, java.lang.Integer cannot be cast to java.lang.String , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT-API , API & Adhoc API Framework , Problem
SAP Knowledge Base Article - Public