here i am trying to fetch opportunity lookup id from opportunityLineItems bt getting this error.-
Error: Compile Error: expecting a colon, found 'oli.OpportunityId' at line 6 column 80
can anyone please help me
public Class Procuct_Adding_To_Order
{
public static void productOrder(List<OpportunityLineItem> oli){
List<Order> ord = [Select id from Order where opportunityId IN: oli.OpportunityId];
for(OpportunityLineItem o : oli)
{
OrderItem op = new OrderItem();
op.OpportunityId = oli.OpportunityId;
op.ListPrice = oli.ListPrice;
op.orderId = ord.id;
op.Product2Id = oli.Product2Id;
op.ProductCode = oli.ProductCode;
op.Quantity = oli.Quantity;
op.TotalPrice = oli.TotalPrice;
ord.add(op);
}
insert ord;
}
}