last day (15 days later) » 

17:09
0
A: System.FinalException: SObject row does not allow errors

Jayant DasYou are getting the error here as you are trying to perform: opp.addError ('Opportunities can not be deleted'); in an after trigger. And that records in after trigger are always read only. The records that fire the after trigger are read-only. If you need to restrict records from being d...

Not always. You can only add undelete validation in the after context.
@AdrianLarson are you referring to rollback scenarios?
Not at all. If you want to prevent recovery from the recycle bin under certain scenarios, the only way to do so is after undelete.
Well, I haven't tried it out myself, but wouldn't the records be still in read-only mode even in that scenario?
Read-only mode doesn't prevent you from adding error to the records. Your understanding is just a shade off here.
17:09
@AdrianLarson it does. Just tried it out. Simple after update trigger, and while adding add error, it throws exactly the same exception as posted by OP.
I tried it out and could reproduce the issue
I don't think you are hearing me. If your premise is that you cannot add errors in an after context, you are clearly wrong because you can still add validations in an undelete trigger.
All I am saying, is that your blanket statement is flawed.
You can, in some cases, add error in an after trigger.
Have you tried whipping up a trigger to validate undelete?
well the issue as posted by OP is basically caused by an after/update trigger. so I was a bit confused as what you were trying to mention because that's what the cause was. I hear you
And the concept of read only doesn't really have anything to do with validation. You are not writing to anything, per se.
Well if seems to have an effect on after insert/update operations though
because you will usually get final exception when performing operations on read only entities
But it does work fine in case of delete operation

last day (15 days later) »