+ Start a Discussion

Standard Field not visible in Schema?

I'm trying to create an Opportunity Product (OpportunityLineItem) but for some reason it isn't accepting the Product2 field.  I know this field exists because it is standard but for some reason it isn't in the schema.  At first I thought it might have something to do with permissions but I have admin privileges and if I look at the field accessibility visibility is set to true for all profiles.  Here's the code (l is a Lead and pbe is a PricebookEntry).


OpportunityLineItem oli = new OpportunityLineItem();
            oli.Quantity = l.Units__c;
            oli.Roll_Call__c = l.Roll_Call__c;
           oli.Product2 = pbe.Product2Id;            //explodes here
            oli.Product_Code__c = l.Product_Code__c;
            oli.OpportunityId = leadOpportunityIds.get(l);


And it won't compile: Invalid field Product2 for Sobject OpportunityLineItem