CAn anyone pls help me out in this I am getting unknwn parsing query error-- public static list<account> getaccount(List<Id> accountIds){ List<Account> acclst=[SELECT Id, Name, Email, Phone, AccountId FROM Contact WHERE AccountId in :accountIds];
Hi Ankita Your List "acclst" is of Account type but you are querying the records from Contact that`s why you are getting error. Hope this helps you. Do let me know if you have any further questions.
P.S : Please mark this as the best Answer if this hepled you.
You are trying to get account from contact table thats why you are getting parsing error.
If you need list of account from Contact you have to traverse through contact to get account list.
Try this:
for(Contact con:[Select Id, Account.Id, Account.Name, Acount.PesrsonEmail, Account.LastName From Contact Where Accountid IN:Accountid]){ acclist.add(con.Account); }
Regards,
Raj
Your List "acclst" is of Account type but you are querying the records from Contact that`s why you are getting error.
Hope this helps you. Do let me know if you have any further questions.
P.S : Please mark this as the best Answer if this hepled you.
Thanks
Shubham Kumar