for(Project_Milestone__c b: [Select id,name,Project_Milestone_Percent__c,Payment_Schedule_Template__c,phase__c From Project_Milestone__c WHERE Payment_Schedule_Template__c =:
PS_nomal ORDER BY Project_Milestone_Percent__c DESC ])
Asked
Active
Viewed 168 times
-3
Salesforce Learner
- 380
- 9
- 32
-
apt = new List<Apartment__c>(); apt = [SELECT id,name,Phase__c,Total_Cost__c FROM Apartment__c WHERE id =: a]; PhaseId = apt[0].Phase__c; Total_Cost = integer.valueof(apt[0].Total_Cost__c); – Salesforce Learner Mar 03 '15 at 09:39
-
I am getting error here while deploying – Salesforce Learner Mar 03 '15 at 09:39
-
possible duplicate of Workarounds to avoid Error: "Too many SOQL queries: 101" and all of these posts. – Christian Deckert Mar 03 '15 at 09:44
-
thanks for the doc can u just point how i can resolve this issue..or if u just modify the above code that would be great – Salesforce Learner Mar 03 '15 at 09:50
-
What does your wrap+normal constructor look like? – Jeremy Nottingham Mar 03 '15 at 13:00
1 Answers
1
The code you posted only has 5 SOQL statements and none of them are in a for loop. The problem could be in any piece of code that executed before this code. The error is saying that you have done 101 SOQL statements and only 100 is allowed.
Have a look at your debug logs and you should see some SOQL that repeats a lot. That will be the code that needs to be refactored. See How do I start to debug my own Apex code? for more information on debugging.