
Here are my scenarios.
- Record x is included in a set of 450 other records and when run through the Bulk API it is saying that is was updated successfully with no errors but the "AccountId" field was not updated.
- Record x is sent through the Bulk API as the only record in the set and the response says success again but this time the "AccountId" field is being updated.
Here is the code for the Bulk API using jsforce.
var requestData = [
{
"LastName": "John",
"Id": "0031h000009kT81AAE",
"AccountId": "0011h00000A55opAAB"
}
]
conn.bulk.load("Contact", "update", requestData, (err, res) => {
if (err) console.log(err);
else console.log(res);
})
When I replace the requestData with another payload that has 450 records instead of just the one, the exact same record says success but it doesn't update the record when I view it in Salesforce.
Does anyone have any ideas what I am doing wrong?1 answer
We has such problem in the past and after long invastigation and a bit of common sense, we fixed that.The problem was that Bulk API it treats the first object as the fields definition for the rest of the Bulk's objects.For instance, if the SF Object you're trying to update in Bulk has fields: a, b, and c and the first Bulk's object has only a and b, it doesn't matter if the rest of the Bulk's objects will have c - it'll ignore it and won't update the value for it, only for a and b.I think that behind the scenes Bulk taking the first object properties, and treat the rest of the objects' values only for those fields and just ignore the rest. (maybe some performance optimization)I fixed that, by adding to the first Bulk's object the full list of fields (based on the SF Object fields list) - and then the whole Bulk objects (really) updated successfully.Hope it helps!