-
Notifications
You must be signed in to change notification settings - Fork 393
Closed
Description
As per #285 when I create a Bulk job with the action of BulkConstants.OperationType.Upsert the library throws an exception:
- Error:
Unknown - Message:
InvalidJob
I've updated our Contact object in salesforce to include a new field Unique_Email__c, specified as Unique and External ID and I'm trying to bulk insert and update contacts from a 3rd party system:
var results = await client.RunJobAndPollAsync("Contact", BulkConstants.OperationType.Upsert,
new List<SObjectList<Contact>> {batch});
Using fiddler to inspect the traffic, the actual issue returned by the Salesforce API is:
<?xml version="1.0" encoding="UTF-8"?>
<error xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<exceptionCode>InvalidJob</exceptionCode>
<exceptionMessage>External ID was blank for Contact. An External ID must be specified for upsert.</exceptionMessage>
</error>
Based on the following request:
<?xml version="1.0" encoding="utf-16"?>
<jobInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<operation>upsert</operation>
<object>Contact</object>
<contentType>XML</contentType>
</jobInfo>
I believe I need to be able to specify the ExternalId Field as per this post https://developer.salesforce.com/forums/?id=906F00000008sEBIAY
<?xml version="1.0" encoding="UTF-8"?>
<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<operation>upsert</operation>
<object>Foo__c</object>
<externalIdFieldName>myExtId__c</externalIdFieldName>
<contentType>CSV</contentType>
</jobInfo>
Note also that at the time that was written, the contentType element needed to be the last element in the request.
NuGet Version of DeveloperForce.Force: 2.0.7
Metadata
Metadata
Assignees
Labels
No labels