I have this trigger to verify this condition , when and status become clos , I can't modifie the object .
Now when I tried to modifie I have this error :
We hit a snag.
Review the errors on this page.
Update : execution of BeforeUpdate caused by: System.FinalException: SObject row does not allow errors Trigger.Update: line 13, column 1
The line 13 is :
OBJ.Statut__c.addError('can t be modified');
My trigger
trigger Update on OBJ__c (before update) {
Id currentUser = UserInfo.getUserId();
Id currentUserProfileId = userinfo.getProfileId();
for(OBJ__c OBJ: trigger.old)
{
if(OBJ.Statut__c == 'Clos' )
{
OBJ.Statut__c.addError('can t be modified');
}
}
}