Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

How to solve when an error is found while running SOQL help with subquery where clause?

Asked by Diana Campbell Aug 24, 2023 1.1K views 1 answer
Share

About this question

I have made two tables, service order and status history (child table). I want to find all the service orders which have a status history record matching ‘Order Complete.’ I have used some queries. But I am getting the error ‘unknown error parsing query.’ 

SELECT Id, Name, CreatedDate, (SELECT Name FROM Status_History__r ORDER BY CreatedDate DESC LIMIT 1)
FROM Service_Order__c
WHERE id = (SELECT id FROM Status_History__r WHERE Name = 'Order Completed')

If I use a new query using SOQL, I am also getting an error that shows that ‘Order Error at Row:3:Column:29 subject type ‘Status_History_r’ is not supported. It also says that I must append the ‘_c’ to use a custom object and asks me to reference the WSDL for an accurate name. 

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.