Hi I tired creating below trigger but it is giving me this error:
Loop variable must be of type CSM_Milestone__c
trigger CSMMilestone on CSM_Milestone__c (After insert, After update) {
List<Opportunity> oppList = [select Id from Opportunity where StageName = 'Closed: Won'];
list<CSM_Milestone__c> csmList = new list<CSM_Milestone__c>();
for(Opportunity o : trigger.new)
{
CSM_Milestone__c csm = new CSM_Milestone__c ();
// quote.Opportunity = o.id;
csm.Name = 'CSM Milestone1';
csmList.add(csm);
if (o.StageName == 'Closed: Won'){
for(Opportunity act: oppList){
csm = new CSM_Milestone__c(Name='testName');
// quote.Opportunity__c = o.Id;
csmList.add(csm);
}
}
}
insert csmList;
}