Symptom
You perform an UPSERT call providing a null value to a date-type field and the errors below are received in return:
Error: Invalid value for field '<date-type_field>' - FAILED_PARSE_DATE_STRING: The date string is null or empty.:
or
The given value null for property startDate is invalid. Valid values are:[]. Please check the property in Admin Center > OData API Data Dictionary. with the index 0
Environment
- SAP SuccessFactors HCM Suite
- SFAPI
- OData
Cause
This error occurs because the date field is being provided in the call with no value, which makes the API understand it as it was being provided with a blank value, which is invalid on date-type fields.
Resolution
Don't mention the date-type field that you want to have the null value in the payload of your API call. This will make the API upsert the field with a null value.
If you are providing the field in the call like this:
<sfobject>
<id>BKG-1234</id>
<type>Background_Awards</type>
<issueDate></issueDate> //date-type field
<name>blabla</name>
</sfobject>
Remove it from the payload, which will make it look like this:
<sfobject>
<id>BKG-1234</id>
<type>Background_Awards</type>
<name>blabla</name>
</sfobject>
Keywords
background, date, successfactors, success, factors, null, empty, blank, sfapi, compound employee, ce, odata, upsert, , KBA , LOD-SF-INT , Integrations , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT-API , API & Adhoc API Framework , How To