+ Start a Discussion
Frantz  CarionFrantz Carion 

Bulk API update based on Salesforce Id

 Hi all,

I'm trying to create a job to update account data via the bulk API matching on the salesforce id.
I could create the job and the batch ok, however i continuously get an error when the batch tries to run: it keeps telling me that the salesforce id field available in the CSV file, whatever the way i named it:
I've tried Id, RecordId, id (in lower case), AccountNumber and for all 4 tentatives, i got the same error message.
I need to be able to mass-update data using the salesforce id (the data i've got was pulled out of salesforce with the SOAP API, retaining the field names the way they are provided by the SOAP API) and can't rely on external id (i'll be always pulling out data from salesforce first, therefore i'll have the salesforce id).

I've been struggling on this error since beginning of the week, unable to find relevant information on using salesforce id in bulk API update specifically. I would be really grateful if someone could help.

Thx in advance
ShashForceShashForce
How are you doing the update? Is it using the Data Loader? And what is the exact error message?
Frantz  CarionFrantz Carion
I'm trying to run the update through the creation of a bulk api job / batch but I keep getting " InvalidBatch : Field name not found : id"

in this case the CSV i've built only has 2 columns, with the only purpose being updating the account names, therefore the 2 columns are Id (= salesforce account id) and Name
 
ShashForceShashForce
We may have to look at your apex class. Would you be able to post it?
Frantz  CarionFrantz Carion
The tool i'm creating is done with c#. I've followed the examples from here to write my code: https://developer.salesforce.com/forums/ForumsMain?id=906F00000009BXnIAM
and here: http://integratesalesforce.blogspot.ch/2013/06/salesforce-using-bulk-api-sample-vbnet.html
(basically the first is a translation from vb to c#). the main difference being the way i build the requestURL, using the returned serverURL from the SOAP API loginresult (using API version 31.0), the operation, in my case update, and obviously the csv file to be used for the update, which in my case only has 2 columns, the salesforce account Id and the Name of the account, to be updated.

By following those 2 examples/tutorials, i don't seem to be missing any step, it does indeed create the job and the batch correctly as i can see the corresponding entries appearing when i log directly in our salesforce dev account. The only issue is the result of the batch clearly states it can't find the Id column in the Account table.

Let me know if based on those 2 links, that have almost identical code to the one i've written, and the details i've added, you are able to help, or if you'd rather have the exact code.

FYI: the data we currently use is basically the test data that you get when creating a developer account, with which we have already played to develop other tools and functions, using the SOAP API, and which we now want to enrich with update based on the usage of the Bulk API (update first, then later may insert and upsert - but clearly update is our main focus).
I couldn't find a page where it would clearly indicates if salesforce Id can be used as the update match key, but i couldn't find anything that would say it can't either.
One thing i couldn't see either is a way to ensure which field is used to match (although Id being defined as primary key it should be used to match by default right?); i understood from the API guide that spec file was only required when not using salesforce fieldnames.

Based on how easy it was to do updates using the SOAP API, simply passing the salesforce id, the fieldname and value to update, i assumed this would work as easily with Bulk, except with more data.

     n          an  
Frantz  CarionFrantz Carion
@shashank: any feedback on my latest post? i am still stuck with this issue with no clue how to solve it.