I want to search on multiple objects using dynamic soql, below is the query where iam want to search any record from any object using dynamic soql.

select id,StageName,name,
  (select id,ProductCode,UnitPrice,Quantity,PricebookEntry.product2id,
          PricebookEntry.product2.ProductCode,product2.name from OpportunityLineItems),
  (select id,Phone,QuoteNumber,Tax,TotalPrice from Quotes) 
from opportunity
  • Hi Nagaraju, and welcome to SFSE! Please take a moment to enjoy our tour, and then read more about How to Ask. I suspect that you may be having an X-Y Problem, and so I invite you to edit your question, put more information in about the goal you're trying to accomplish, and let us guide you to an appropriate solution. – sfdcfox Jun 8 '18 at 7:03
  • 1
    Why don't you use SOSL. SOSL is made for searching – Pranay Jaiswal Jun 8 '18 at 7:17

Your Answer

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

Browse other questions tagged or ask your own question.