I have a problem. I need to be able to return properties if they have opportunities in "test". There isn't a relationship from property down to opportunity. But there is a relationship from opportunity up to property.
(Hope im saying that right)
Anyways, is there a way to get properties if they have opportunities in a certain category?
@AuraEnabled
public static List <Opportunity> searchProperty(String searchString)
{
//query opportunities. Put project name in a list. return the list.
String searching = searchString + '%';
List <Opportunity> returnList = new List <Opportunity> ();
List <Opportunity> lstOfProperties = [select Property__r.name, name from opportunity
where recordtype.name in ('Test')
and Property__r.Name LIKE: searching and Probability not in (0,5,100)
order by Property__r.Name].Property__r.Name;
for (Opportunity acc: lstOfProperties)
{
returnList.add(acc);
}
system.debug(returnList);
return returnList;
}