You need to sign in to do that
Don't have an account?
bvdb
Preventing an Insert with trigger
Is there a way to prevent a record from being insert in with (Trigger.isBefore && Trigger.isInsert)?
For example, if I insert 5 records and one of them isn't valid (based on a custom validation I have in the trigger), can I have the system bypass the invalid record and only insert the other 4?
I'm using addError() in my trigger for invalid records. This works fine in the UI but when I insert a list of records, the entire insert fails if it comes across one erroneous record.
If you use the Database.insert method, then according to the docs:
The optional opt_allOrNone parameter specifies whether the operation allows partial success. If you specify false for this
parameter and a record fails, the remainder of the DML operation can still succeed