trigger GudMorning on Class__c (before insert,after insert) {
if(trigger.isbefore){
for(Class__c c1 : Trigger.new){
c1.State__c = 'AP';
}
} else {
List<Class__c> crlst = new List<Class__c>();
if(trigger.isafter){
for(Class__c cr : Trigger.new){
cr.State__c = 'TN' ;
//insert cr;
crlst.add(cr);
}
}
}
}
Attribution to: sumanth
Possible Suggestion/Solution #1
Change your trigger to before insert only (remove after insert) and it will work. The bit you have after insert should be done before.
Having said that, your trigger as written just doesn't make sense. What are you trying to do?
Attribution to: DavidSchach
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33173