Symptom
When performing an Odata API upsert in a field related to a picklist, the error below is thrown:
"The given value XXXXX for option YYYYY is invalid"
The value XXXXX is the picklist optionID and the value YYYYY is the picklist name you are trying to upsert.
Environment
- SAP SuccessFactors HXM Suite
- OData API
Reproducing the Issue
Perform an Odata upsert in a field related to a picklist.
Cause
Notice that a picklist could have many labels and each label is set for one locale.
When making API calls, the request's locale is considered which is the API user defaultLocale field.
In these scenarios, the cause is there is no picklist label set for the API_user defaultLocale.
Resolution
First, check the value of the API user defaultLocale field (e.g. GET https://api4.successfactors.com/odata/v2/User?$filter=userId eq API_user_name &$format=json).
Then go to Picklist Center, open the picklist and see there is no label set for this locale (e.g. https://api4.successfactors.com/odata/v2/PicklistOption?$filter=id eq picklist_name &$format=json&$expand=picklistLabels).
There are two possible solutions:
- Create a label with the same locale as the API user;
- Add the "fileLocale=" parameter (e.g. fileLocale=en_US) in the Odata query to force some locale as the request's locale.
See Also
Keywords
EmpJob, error, customString, null , KBA , LOD-SF-INT , Integrations , LOD-SF-INT-ODATA , OData API Framework , Problem