cancel
Showing results for 
Search instead for 
Did you mean: 

SuccessFactors OData API purgeType=full not working. How to replace EmpEmployment/EmpJob entities

jmalla
Contributor

I am have an employee in the system for which I am trying to delete/replace their EmpEmployment and EmpJob information. The employee record has a start and end date - since the employee is termed.

When I try to change this record, with the following:

I am calling the URL:

https://api4preview.sapsf.com:443/odata/v2/upsert?purgeType=full
With the Content-type as application/atom+xml
<?xml version="1.0" encoding="utf-8"?>
<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" xml:base="https://api4preview.sapsf.com:443/odata/v2/">
    <title type="text">EmpEmployment</title>
    <entry>
        <id>https://api4preview.sapsf.com:443/odata/v2/EmpEmployment(personIdExternal='810202',userId='810202')</id>
        <content type="application/xml">
            <m:properties>
                <d:personIdExternal>810202</d:personIdExternal>
                <d:userId>810202</d:userId>
                <d:startDate m:type="Edm.DateTime">2018-04-01T00:00:00</d:startDate>
                <d:benefitsEligibilityStartDate m:type="Edm.DateTime">2018-04-01T00:00:00</d:benefitsEligibilityStartDate>
                <d:originalStartDate m:type="Edm.DateTime">2018-04-01T00:00:00</d:originalStartDate>
                <d:customString7>26121</d:customString7>
                <d:seniorityDate m:type="Edm.DateTime">2018-04-02T00:00:00</d:seniorityDate>
            </m:properties>
        </content>
    </entry>
</feed>

I get the error - Start date cannot be greater than the end date.:

<?xml version="1.0" encoding="utf-8"?>
<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>EmpEmployment/personIdExternal=810202,EmpEmployment/userId=810202</d:key>
                <d:status>ERROR</d:status>
                <d:editStatus m:null="true"></d:editStatus>
                <d:message>Start date cannot be greater than the end date.
 Failed record info: {EmpEmployment/personIdExternal=810202, EmpEmployment/userId=810202, EmpEmployment/startDate=2018-04-01T00:00:00.000-04:00, EmpEmployment/benefitsEligibilityStartDate=2018-04-01T00:00:00.000-04:00, EmpEmployment/originalStartDate=2018-04-01T00:00:00.000-04:00, EmpEmployment/customString7=26121, EmpEmployment/seniorityDate=2018-04-02T00:00:00.000-04:00}. 
  for Key EmpEmployment/personIdExternal=810202,EmpEmployment/userId=810202 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>
        </content>
    </entry>
</feed>

I am passing a start date in the future compared to the start and end date on the employee record - but I still get this error. I am anticipating that SuccessFactors API purge this EmpEmployment record and add a new one with the purgeType=full option but that is not doing anything it seems.

Here is the documentation for the SuccessFactors Data API help:

1.14.5 Processing Parameters for Upsert


The Employee Central Upsert API supports both Full purge and Incremental updates using parameters. If no parameters are provided, the system checks whether the entity being updated supports incremental update. If it does, an incremental update is performed. Else, the system performs a full purge on the record.


1.14.5.1 Full Purge
If the processing parameter is set to full purge, the existing record for the given employee is deleted when the
upsert operation is performed. A new record is then created with the data specified in the payload. In SOAP, the
purgeType is specified as follows:
 
<urn:processingParam>
 <urn:name>purgeType</urn:name>
 <urn:value>FULL</urn:value>
 </urn:processingParam>

In OData, the purgeType is specified through a URL parameter. A typical request would look like:
odata/v2/upsert?purgeType=full


I do have EmpJob records - hire and termination events that are tied to the EmpEmployment record, so I am wondering if that is the issue.

Basically, I need to delete/replace both EmpEmployment and EmpJob records to reflect a new start date and new termination date.

Any help would be appreciated.

Thanks,

Jay

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Any updates here? Facing the same issue.

0 Kudos

Hi, I am also looking for a solution for Rehire Employee with same PersonnelNumber, and when I do so, getting an error message as explained in the above post.

Looking forward to an answer here.

0 Kudos

Hi, Is this issue resolved? I'm facing same issue while rehiring employee with existing personid.