Rollback/Fail Entire Data Load on Error Instead of Partial Load

we have a process where we are loading events in via the Data Loader and have a before insert trigger on the event/activity to handle these records as they are being processed. We’d like that if one of the records has an error to fail the entire job, instead of just failing that record and allowing a partial insert.

I’ve done some digging and unfortunately it seems like this isn’t possible due to the batch nature of using the data loader and the bulk api, but hoping I’m missing something. Thanks!


There is really no way to do this because of the way Data Loader works

For example – imagine Data Loader batch size is 4 and you have these records

---- transaction boundary ----

So, further imagine that all six (6) events belong logically to the same parent object. And that 04Event fails validation rules and hence all six events should be rolled back

But, the first 4 events are in one transaction where all records pass VRs and hence are committed – even if data loader didn’t support partial successes (which it does). Even if records [4] and [5] failed to insert as a batch, your parent object would have an incomplete list of events — at least as far as your application requirements seem to demand

So, a workaround solution is to

  • first update the parent object with a count of expected children events,
  • upload the events per Data Loader with partial success supported
  • have a RSF on the parent object with a count of actual Events
  • an IMAGE formula on your detail page (or a workflow to notify sysad) that indicates that one or more events are missing when expected != actual count of child events.

Source : Link , Question Author : George Albrecht , Answer Author : cropredy

Leave a Comment