opprecordcombo the execution of the beforeupdate caused by systemfinalexception sobject row does not allow errors if

  1. Don’t pass trigger.newMap to your method. This variable is Map<Id, Opportunity> and when you are before insert ids don’t exist yet (well, duh). You don’t have keys for the map so the variable will be empty and your logic will be skipped. Pass trigger.new instead.
  2. Don’t SELECT ... FROM Opportunity WHERE Id IN : .... You have the “new” state of data right there, passed from trigger. If you query you’ll get old data from before this save operation, not what the user edited right now. Or nothing (because if you’re before insert – stuff doesn’t exist in database yet). Work on the original, on trigger.new.
  3. You cannot addError() on something you queried. It’s not changing right now. The FinalException is not a great name but it tells you to put addError on elements of trigger.new

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top