You need to sign in to do that
Don't have an account?
Tanya Shah
Error in trigger
Whenever Opportunity Stage is Updated to “Closed Won” , need to update them on the OpportunityIineItem using trigger . Have created a custom field to update the systemdate.
It is giving me error "Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<OpportunityLineItem> at line 17 column 9 " . Where am i makeing mistake ?
It is giving me error "Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<OpportunityLineItem> at line 17 column 9 " . Where am i makeing mistake ?
trigger OpportunityWon on Opportunity (after update) { Set<Id> relevantIds = new Set<Id>(); // select relevant opportunities for(Opportunity o : trigger.new) { if(o.StageName == 'Closed Won' || trigger.oldMap.get(o.Id).StageName == 'Closed Won') { relevantIds.add(o.Id); } } // Line Items OpportunityLineItem[] olis = [SELECT ID, WonWhen__c, OpportunityId FROM OpportunityLineItem WHERE OpportunityId IN :relevantIds]; for(OpportunityLineItem oli :olis ) { olis.WonWhen__c = system.today(); } if (olis.size()>0) update olis.values(); }
Line 17, replace "olis" by "oli"
Jerome