I am trying to run a SOQL query on my Account Object pulling data from a custom Object A that contains the Account name and it's Global Enterprise and Main HQ. It's a hierarchy of sorts.
In a list view, I am trying to exam if the account that I am on has a Main HQ and if it does, it needs to pull in all of the available Opportunities for every account that has Main HA = Company A. This is the same for accounts where the Global Enterprise is Company Z.
If the Global Enterprise and Main HQ fields are populated on the account, then the list view should show for each of them them separately.
I am new the apex classes and SOQL and would like some assistance on the class and SOQL call out.
public class Examplefilter {
Public Static List<Custom_ObjectA> searchforCustom_ObjectA (string Global_Enterprise__c, string Main_HQ__c, String Opportunity__r.Name, String Account_Name__r.Name) {
Return[SELECT Id, Opportunity__r.Name, Account_Name__r.Name, Main_HQ__c, Global_Enterprise__c
FROM Custom_ObjectA
WHERE Main_HQ__c = :Main_HQ__c AND Global_Enterprise__c = :Global_Enterprise__c];
}
}