SAP Knowledge Base Article - Public

3386831 - Unable to delete e-mail address using SFOData.PerEmail API entity

Symptom

The following error is thrown by API server while performing DELETE operation on PerEmail entity.

ERROR: isPrimary contains an invalid flag for boolean field. Only “Y”/“Yes”/“T”/“True”/“1” or “N”/“No”/“F”/“False”/“0” are supported

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 HXM Suite

* OData API

Reproducing the Issue

HTTP Method: POST 

Request URI

https://apisalesdemo2.successfactors.eu/odata/v2/upsert?$format=json

Request Payload

[
    {
        "__metadata": {
            "uri": "PerEmail(emailType='8448', personIdExternal='adminrp')"
        },
        "operation":"DELETE"
    }
]

Response Payload

{
    "d": [
        {
            "key": "PerEmail/emailType=8448,PerEmail/personIdExternal=adminrp",
            "status": "ERROR",
            "editStatus": null,
            "message": "isPrimary contains an invalid flag for boolean field. Only ‘Y‘/’Yes‘/’T‘/’True‘/’1’ or ‘N‘/’No‘/’F‘/’False‘/’0’ are supported.\n Failed record info: {PerEmail/operation=DELETE, PerEmail/emailType=8448, PerEmail/personIdExternal=adminrp}. \n  for Key PerEmail/emailType=8448,PerEmail/personIdExternal=adminrp with the index 0",
            "index": 0,
            "httpCode": 500,
            "inlineResults": null
        }
    ]
}

Cause

isPrimary property of PerEmail entity is not passed in the OData API request payload to perform DELETE operation.

Resolution

There are two types of delete operations: hard delete and soft delete. A hard delete permanently removes an entry from the database while a soft delete marks the entry as deleted. Soft deleted entries can be accessed with certain tools, for example, an audit report. 

A successful delete operation returns status 200 OK with no response payload.

The following OData API call is the correct way to delete an e-mail address by performing DELETE operation on SFOData.PerEmail entity.

HTTP Method: POST 

Request URI

https://apisalesdemo2.successfactors.eu/odata/v2/upsert?$format=json

Request Payload

[
    {
        "__metadata": {
            "uri": "PerEmail(emailType='8448', personIdExternal='adminrp')"
        },
        "isPrimary": true,
        "operation":"DELETE"
    }
]

Response Payload

{
    "d": [
        {
            "key": "PerEmail/emailType=8448,PerEmail/personIdExternal=adminrp",
            "status": "OK",
            "editStatus": "UPSERTED",
            "message": null,
            "index": 0,
            "httpCode": 200,
            "inlineResults": null
        }
    ]
}

Keywords

PerEmail, OData, DELETE, operation, upsert, e-mail address, isPrimary, boolean, invalid, flag, POST, HTTP, method , KBA , LOD-SF-INT-EC , Employee Central SFAPI & OData Entities , LOD-SF-INT-ODATA , OData API Framework , Problem

Product

SAP SuccessFactors HXM Suite 2305