Symptom
When performing the UPSERT operation to update a field, getting required field error in the response:
<m:properties>
<d:key m:null="true"></d:key>
<d:status>ERROR</d:status>
<d:editStatus m:null="true"></d:editStatus>
<d:message>date1 required, date2 required, country required, for templateId 123, with the index 0</d:message>
<d:index m:type="Edm.Int32">0</d:index>
<d:httpCode m:type="Edm.Int32">500</d:httpCode>
<d:inlineResults m:type="Bag(SFOData.UpsertResult)"></d:inlineResults>
</m:properties>
Environment
SAP SuccessFactors Recruiting Management
Reproducing the Issue
You are performing a upsert operation to update single field 'Id' of the application. This is just an example.
- Use a method to perform upsert operation (e.g. POSTMAN)
- Insert the url: https://api(DATA CENTER).successfactors.com/odata/v2/upsert (this url should be based on your instance data center)
- Provide API username and password
- Insert the values you wish to update
- Receive the error message: FieldID is required [...], with the index 0
Cause
For entities JobApplication and Candidate (please note that this refers to the Candidate entity, not CandidateLight), it's required to pass all the information of all required fields.
Resolution
When we are using upsert operation, it is required/mandatory to pass value/data for all the required fields of the template even if we just want to update a single field.
In the JobApplication and Candidate entities, there is no way to bypass the required information as we can do with JobRequisition's isDraft option. However, it is possible, for Candidate Profiles, to bypass the required fields by using, instead, the CandidateLight entity. More details about this functionality can be found here: 2569249 - How to insert a Candidate without providing all the required fields configured in the Candidate Profile Template with OData API
See Also
2569249 - How to insert a Candidate without providing all the required fields configured in the Candidate Profile Template with OData API
Keywords
OData API, Upsert operation, Upsert, Required field with index error, candidate, application, jobapplication, candidatelight. , KBA , LOD-SF-RCM-API , Webservices & APIs , Problem