+ Start a Discussion

Before trigger prevent insert of some records without error?

I need to suppress the creation of some Chatter feed items based on the parent object without causing error or rollback (I'd rather not get into the fairly convoluted why). I'm thinking it should be possible to do this using a before trigger, but I haven't figured out how yet. Any pointers?

trigger suppressSelectedFeedItems on FeedItem (before insert) {
  for (FeedItem fi: trigger.New){
      //I need something here to suppress the insert of this record without reporting an error
Hi Davcondev, before insert can do some logic in the background before inserting a record (the record will however gets inserted with or without this logic) unelss there are any validation rule errors that are preventing the record from getting created. Hope this helps