Is there a possibilty in Salesforce from trigger beforeInsert how to stop the insert in the database table.

  • It's quite difficult to understand what you're asking as the question stands. Please provide more detail. Do you perhaps mean how do you prevent record insertion, based on some criteria, from within a trigger? – Brian Mansfield Jul 15 '15 at 20:32

Using the SObject method addError on a record will prevent any DML operations (including inserts) from occurring on that record.

trigger preventContactInserts on Contact (before insert) {
  for (Contact c : Trigger.new) {
    if (c.FirstName=='Brian' && c.LastName=='Mansfield') {
      c.addError('You can't insert this record.');

Not the answer you're looking for? Browse other questions tagged or ask your own question.