Zed
Zed

Reputation: 13

Salesforce Bulk API Delete by externalIdFieldName

Note I am not using Bulk Api 2.0

Is there way to delete salesforce objects using the external salesforce Id? When I set up the job I sent the following:

{
  "operation" : "delete",
  "object" : "Subscription",
  "contentType" : "JSON",
  "externalIdFieldName": "ExternalId"
}

But when I post the batch with the external Id it fails; Request:

[{"externalId":"123456789"}]

Response:

[
    {
        "success": false,
        "created": false,
        "id": null,
        "errors": [
            {
                "message": "bad id 123456789",
                "fields": [],
                "statusCode": "MALFORMED_ID",
                "extendedErrorDetails": null
            }
        ]
    }
] 

Other combinations also fail:

[{"Id":"123456789"}]
[{"externalIdFieldName":"123456789"}]

It does delete if I use the salesforce ID

[{"Id":"xu97987oUv"}]

But I want to delete using the external ID if that is possible.

Upvotes: 1

Views: 1339

Answers (1)

Balaji Pooruli
Balaji Pooruli

Reputation: 250

This is not possible. You have to query the salesforce record with the external id field to get the salesforce id of the record and use it to delete the record.

Upvotes: 2

Related Questions