function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mbiamontembiamonte 

Bulk API per row error messages

I am coding bulk operations through version 18 of the Bulk API.  A job is submitted with one or more batches.  If a batch fails because it could not be processed the batchInfo result returns the Failed state and puts the reason why the batch was not run in the stateMessage.  That is all good.  However if the batch runs, but one or more records in the batch fails, I don't see how to get the reason why the particular record fails.  Processing the batch results shows that the record failed, but it does not give a reason.  Is there a way to get the error message for a particular row of a batch?

 

 

jesperfjjesperfj

It should give a reason. Can you give a specific example?

Mark SFMark SF

This is a very late reply, but for future reference, here is some doc on how to handle failed records in batches:

 

http://www.salesforce.com/us/developer/docs/api_asynch/index_Left.htm#StartTopic=Content/asynch_api_batches_failed_records.htm

 

 

 

 

jesperfjjesperfj

Try using this code snippet to get all records with errors, including the error message:

 

http://blog.sforce.com/sforce/2010/06/retrieving-all-records-with-errors-from-a-bulk-api-job.html

mbiamontembiamonte

Thanks Mark and Jesper for the replies.

 

I did find that the error message does come back with the batch result.  The problem I had is that the Bulk API documentation shows the batch result as

 

<?xml version="1.0" encoding="UTF-8"?>

<results xmlns="http://www.force.com/2009/06/asyncapi/dataload">

<result>

<id>001D000000ISUr3IAH</id><success>true</success><created>true</created>

</result>

<result>

<id>001D000000ISUr4IAH</id><success>true</success><created>true</created>

</result>

</results>

 

As a result, I initially coded the batch result processing to only look for the id, success and created fields.  Looking at the raw result that came back, I did notice the error column in the CSV version of the batch results.  Sorry for not replying to this post sooner with my findings.

 

Also thanks for the link on handling errors.  I had not come across that yet.