Symptom
You are getting the below error in SuccessFactors while upserting the AutoDelegateDetail for employee to SuccessFactors.
- The associated error message is "The delegation setup must be unique. with the index 0".
Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.
Environment
SAP SuccessFactors HCM Suite
- Integration
- ODATA API
Reproducing the Issue
We perform the Upsert Operation with the below Sample Code and you get error:
{
"__metadata": {
"uri": "https://api10preview.sapsf.com/odata/v2/AutoDelegateDetail(AutoDelegateConfig_delegator='user_admin',externalCode='1234567')",
"type": "SFOData.AutoDelegateDetail"
},
"externalCode": "0L",
"AutoDelegateConfig_delegator": "user_admin",
"alwaysOn": true,
"delegatee": "1234567",
"status": "ON"
}
And you get the below error
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code>COE_GENERAL_SERVER_FAILURE</code>
<message lang="en-US">ChangeSet index 2 - The delegation setup must be unique. with the index 0</message>
</error>
Cause
The externalCode API field is a key field for AutoDelegateDetail Entity. This is a unique value and can't be edited (or upserted). Hence you shouldn't provide any data in this field.
Resolution
Since externalCode is a standard, auto-generated field, you need to pass the externalCode value as "0L". This will trigger the auto-generation of the value and successfully upsert the delegation data.
Please refer the below Sample query:
Request Payload:
{
"__metadata": {
"uri": "https://api10preview.sapsf.com/odata/v2/AutoDelegateDetail(AutoDelegateConfig_delegator='admin_user',externalCode='0L)",
"type": "SFOData.AutoDelegateDetail"
},
"externalCode": "0L",
"AutoDelegateConfig_delegator": "admin_user",
"alwaysOn": true,
"delegatee": "123456",
"status": "ON"
}
Response Payload
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<entry>
<content type="application/xml">
<m:properties>
<d:key>AutoDelegateConfig/delegator=cgrante</d:key>
<d:status>OK</d:status>
<d:editStatus>UPSERTED</d:editStatus>
<d:message m:null="true"/>
<d:index m:type="Edm.Int32">0</d:index>
<d:httpCode m:type="Edm.Int32">200</d:httpCode>
<d:inlineResults m:type="Bag(SFOData.UpsertResult)"/>
</m:properties>
</content>
</entry>
</feed>
See Also
Keywords
SuccessFactors, Delegation, Error, Index 0, SAP, Employee Central, Authority, Interface, HCI, CPI, COE_GENERAL_SERVER_FAILURE,ChangeSet index 2 - The delegation setup must be unique. with the index, LOD-SF-INT-API , KBA , LOD-SF-INT-API , API & Adhoc API Framework , LOD-SF-INT-CPI , Standard SF to 3rd Party CPI (HCI) Content , LOD-SF-INT-ODATA , OData API Framework , Problem