This is a real estate development that has a Development object and a Property__c object. Properties can be related to a Development or not. Also, properties are tied to opportunities. Now I need to query properties that are available. That is, properties that are not related to an opportunity or only related to 'Closed Lost' opportunities.
I'm trying to get a list with at least the opportunity stage on it but I'm getting the following error:
ERROR at Row:1:Column:106 Didn't understand relationship 'Opportunities' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
This is the query: SELECT Development1__c, Name, Asking_Price__c, Meters__c, Property_Type__c, (SELECT Name, StageName FROM Opportunities) FROM ARCO_Property__c WHERE Property_Type__c != 'Renovated Commercial (Retail)'
I have also tried:
...(SELECT Name, StageName FROM Opportunity)...
or
...Opportunity.StageName FROM ARCO_Property__c...
or
...Opportunities.StageName FROM ARCO_Property__c...
or
...Opportunity__r.StageName FROM ARCO_Property__c...
without any successful result.
Both selects work fine when alone. I get error when trying to 'JOIN' them.
Expanded info
Using Workbench I've noticed that apparently there isn't a relationship in ARCO_Property__c
for the field StageName
of the Opportunity
object:
But the Opportunity
object does have a Property__c
field...
Finally, answering sfdcfox question, there is a lookup relationship from Opportunity to Property.
Again, what needs to be achieved is to show a list with the apartments for a specific development and availability status for each unit.