You need to sign in to do that
Don't have an account?
Linda 98
Error:Initial term field expression of type List:
Please help me in making the code work for multiple records.
Ii am having two queries ..I wrote where condition as xyz[0].abc.Xyz is another list.
Here are my queries:
List<Opportunitylineitem> Opplinitemlist =[select Id,PricebookEntry.Product2.Name,PricebookEntry.Product2.id,
from Opportunitylineitem where Opportunityid IN :Trigger.newMap.keySet() and Acc__c =''];
if(opplinitemlist.size()>0)
List<acc__c> query=[select id,name,serfvice date from Acc__c where Acc__c.product__c=:opplinitemlist[0].PricebookEntry.Product2.id and Acc__c.Account__c =: Opportunitylist[0].accountid ];
I am aware that i have to use for loop and run through each record.but i am getting error:INitiall term field expression.
Pls help
Ii am having two queries ..I wrote where condition as xyz[0].abc.Xyz is another list.
Here are my queries:
List<Opportunitylineitem> Opplinitemlist =[select Id,PricebookEntry.Product2.Name,PricebookEntry.Product2.id,
from Opportunitylineitem where Opportunityid IN :Trigger.newMap.keySet() and Acc__c =''];
if(opplinitemlist.size()>0)
List<acc__c> query=[select id,name,serfvice date from Acc__c where Acc__c.product__c=:opplinitemlist[0].PricebookEntry.Product2.id and Acc__c.Account__c =: Opportunitylist[0].accountid ];
I am aware that i have to use for loop and run through each record.but i am getting error:INitiall term field expression.
Pls help
All Answers
I believe the [0] might be throwing your query off. Try setting opplinitemlist[0].Pricebookentry.product2.Id to it's own variable, and then use that in the binding instead. For instance:
But please update your code to handle bulkification and don't throw your SOQL in a for loop.
How can i make it work for multiple records...