Symptom
"Full Purge" is a Processing Parameter for Upsert. The existing record for the employee is deleted when this upsert operation is performed. A new record is then created with the data specified in the payload.
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 OData API
Resolution
Few scenarios will be discussed here which will help you to understand the behaviour of "PerEmail" entity UPSERT with "Full Purge" option. You can customize your own scenario as per your business requirement.
Scenario 1:
personIdExternal='akoelemij'
You have below data in the System (User Interface -> Contact Information -> Email Information) -
>> Only one Email Address : anna@abc.com [ Is Primary = True, Email Type : 17161 (Business) ]
Now, via API UPSERT, we will add anna@sap.com as Primary Email ID of Business Type and Make anna@abc.com as Non-Primary Email ID of Personal Type.
Request would look like below:
https://apisalesdemo4.successfactors.com:443/odata/v2/upsert?$format=json&purgeType=full
Request Payload:
[{"__metadata":{"uri":"PerEmail(emailType='17161', personIdExternal='akoelemij')"},"emailType":"17161","personIdExternal":"akoelemij","emailAddress":"anna@sap.com","isPrimary":true},{"__metadata": {"uri":"PerEmail(emailType='5850', personIdExternal='akoelemij')"},"emailType":"5850","personIdExternal":"akoelemij","emailAddress":"anna@abc.com","isPrimary":false}]
After the Upsert:
anna@sap.com has been added as Primary Email ID of Business Type and anna@abc.com has been made Non-Primary Email ID of Personal Type.
Scenario 2:
personIdExternal='akoelemij'
You have below data in the System (User Interface -> Contact Information -> Email Information) -
>> Only one Email Address: anna@ao.com where "is Primary" = True
Now, we will change this primary email address to anna@sap.com for this user via API UPSERT.
Request would look like below:
https://apisalesdemo4.successfactors.com:443/odata/v2/upsert?$format=json&purgeType=full
Request Payload:
[{"__metadata":{"uri":"PerEmail(emailType='17161', personIdExternal='akoelemij')"},"emailType":"17161","personIdExternal":"akoelemij","emailAddress":"anna@sap.com","isPrimary":true}]
After the UPSERT:
Email Address for User "akoelemij" will be changed to anna@sap.com for Email Type 17161.
Scenario 3:
personIdExternal='akoelemij'
You have below data in the System (User Interface -> Contact Information -> Email Information) -
>> anna@abc.com is Primary Email Address and anna@sap.com is Non-Primary Email Address
Now, via API Upsert we will swap these Primary Statuses.
Request would look like below:
https://apisalesdemo4.successfactors.com:443/odata/v2/upsert?$format=json&purgeType=full
Request Payload:
[{"__metadata":{"uri":"PerEmail(emailType='17161', personIdExternal='akoelemij')"},"emailType":"17161","personIdExternal":"akoelemij","emailAddress":"anna@abc.com","isPrimary":false},{"__metadata": {"uri":"PerEmail(emailType='5850', personIdExternal='akoelemij')"},"emailType":"5850","personIdExternal":"akoelemij","emailAddress":"anna@sap.com","isPrimary":true}]
After the UPSERT:
anna@abc.com has become Non- Primary Email Address and anna@sap.com has become Primary Email Address.
Keywords
purgeType=full, PerEmail, ODATA, UPSERT, Full Purge, SuccessFactors, API, How to , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT , Integrations , How To