I am attempting to refresh an account list that I utilize within the execute function of a batch class. I am trying to do this by wrapping the query in a function. My purpose in doing this is so I do not have to repeat the query code when it needs to be refreshed, but instead just execute the function.
I have tried public, private, returning and non-returning values. I receive an unexpected token when I try to state public/private and when leaving it as just the function, it's expecting ;
like a variable declaration. What am I missing here?
global void execute(Database.BatchableContext BC, List < Customer_Obj__c > custObjList) {
List < Account > accList = new List < Account > ();
List < Contact > conList = new List < Contact > ();
//QUERY SALESFORCE FOR MATCHES
for (integer i = 0; i < custObjList.size(); i++) {
List < Contact > relConList = new List < Contact > ();
List < Account > relAccList = new List < Account > ();
//FIND RELATED ACCOUNTS
queryAccountMatches() {
relAccList = [select Id, Name from Account where Name =: customObjList[i].Custom_Field__c];
}
//REFRESH relAccList
queryAccountMatches();
}