1

Is it possible to prevent single record from being inserted in before trigger without addError()? I'd like to be able to insert just a subset of inserted records without throwing any errors.

4
  • what do you mean by subset here? Commented Jun 9, 2016 at 8:56
  • When someone tries to insert [a, b, c], I'd like to make it [a, b] in some conditions. Commented Jun 9, 2016 at 9:00
  • 1
    If you are doing bulk insert from apex then use Database.insert and it will only add error to specific record and will not stop other. Dataloader already provide this functionality. Commented Jun 9, 2016 at 9:02
  • @tusharSharma, please add it as an answer as it seems good enough for my requirements. Also, please mention the all or none flag in database.insert Commented Jun 9, 2016 at 9:15

1 Answer 1

1

If you are doing bulk insert from apex then use Database.insert and it will only add error to specific record and will not stop other. Dataloader already provide this functionality.

Also don't forget to add all or none flag .

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .