function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

.addError - SObject row does not allow errors

I've tried several variations of this with no luck. My guess is that I'm implementing .adderror incorrectly. I get this error:


SObject row does not allow errors Class.IdeaSolution.ideaIdToCase: line 176, column 6 Trigger.IdeaAfterUpdateAfterInsert: line 4, column 2: Class.IdeaSolution.ideaFromSolution: line 83, column 6



List<case> updateCases = New List<case>();
Case[] c = [select Idea__c,CaseNumber from case where id in :caseSolutionMap.keyset()];
for (Integer i = 0; i < c.size(); i++)
if (c[i].Idea__c != Null)
c[i].addError('There is already an idea associated with case ' + c[i].CaseNumber + '. This must be resolved before continuing.');
c[i].Idea__c = solutionIdeaMap.get(caseSolutionMap.get(c[i].id));
update updateCases;




Message Edited by ehartye on 06-17-2009 10:14 AM
Best Answer chosen by Admin (Salesforce Developers) 

Looks like you are trying to add the error to an element you are querying for.  I believe the only thing you could add the error to in trigger, is the elements the trigger is fired on ( something from your for example).