1

I am trying to find how to go about resolving this error.

Error: Compile Error: Illegal assignment from List to List at line 4 column 21

trigger productupdate on Opportunity (after insert,after update)
     {      
      List<Opportunity> opp=[select id,Production_date__c,(select id,ServiceDate from OpportunityLineItems)from Opportunity];
                for(Opportunity op:opp)
                {
                    date olddate=oldMap.get(op.id).Production_date__c;
                    date newdate=newMap.get(op.Production_date__c);
                    integer diffdays=olddate.daysbetween(newdate);
                    for(OpportunityLineItem opl:op.OpportunityLineItem)
                    {
                        opl.ServiceDate =(op.diffdays+opl.ServiceDate);
                    }
                 }
                 update opp;
                 }

enter image description here

3

Looks like you might have a class in the system with the name opportunity.

Either rename that class to something or instead of Opportunity use System.Opportunity

1
  • 1
    thanks it worked, I had the apex class in the same name opportunity
    – arun
    Jul 25 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.