I have a class that calls to an apex method with in a for loop and that method in-turn calls other apex method. All the methods have SOQL's in them.
Running into 101 SOQL issue.
for(sobject obj:somelist) { apexclass1.mehtod1(obj); } public class apexclass1 { public void method1(obj) { List<Sobject> queryresults = [select id from sobject where id=:obj.Id]; apexclass2.method2(queryresults.Id); } } public class apexclass2 { public void method2(Id) { List<Sobject> queryresults = [select id from sobject where id=:Id]; } } I tried to bulkify the methods by eliminating loops and passing list<> instead of single record to methods. But I might end-up disturbing existing functionality somewhere.
What would be the better and safe approach now?
srcfolder.