Symptom
You would like to create/update Secondary Employment of an employee, so you are using OData API to upsert entity "SecondaryAssignments"
You prepare the data in the payload but upsert failed with below error:
- You have selected more secondary employments than allowed. Please confirm there is an active primary employment on the effective date of this record. with the index 0
Environment
SAP SuccessFactors HCM Suite
- OData API
Reproducing the Issue
Upsert "SecondaryAssignments" entity, with an inline structure to specify the secondary employment.
eg. https://api68sales.successfactors.com/odata/v2/upsert
Payload:
Cause
When you use above inline structure for API upsert, it will by default create a new record for the child entity (Secondary Employment).
If (after API upsert) an employee has more secondary employments than allowed, the API upsert will fail.
For example, in "Manage Data" you can check this record and find the number of employments for this employee (2 employments in this example).
One of them should be kept as primary employment, and the remaining can be set as secondary employment (e.g. this sample user can have at most 2-1=1 secondary employment).
Resolution
When you upsert via OData API, please make sure the number of secondary employments will not exceed the allowed number, and there is a primary employment on the effective date of this record.
If you would like to replace the existing record with your API payload, you could use parameter "purgeType=full" (replace for all time slices), or use parameter "purgeType=record" (only replace the specified time slice).
See Also
3083481 - Upserting an effective-dated MDF record with a composite association (child records) causes it to inherit the child record associations from previous record - SAP SuccessFactors OData API
Keywords
SF, SuccessFactors, Success Factors, configuration, insert, maximum, External Code, User ID, userId, parent, MDF , KBA , LOD-SF-INT-EC , Employee Central SFAPI & OData Entities , LOD-SF-INT-ODATA , OData API Framework , Problem
Product
Attachments
| Pasted image.png |
| Pasted image.png |
SAP Knowledge Base Article - Public