You need to sign in to do that
Don't have an account?
Getting Too Many SOQL Queries
public class UpdateFieldOnOpportunity implements Schedulable { public List Opp {set; get;} Public List<Insertion__c> Ins { set; get; } public Integer j = 0; public void updateFields() { Opp= [SELECT Id,Name,Account_Name__c, Formula_Video__c, Insertion__c FROM Opportunity WHERE Formula_Video__c > 0 ]; System.debug('*********Opportunities with Formula Video above Zero**********'+ Opp.size()); Ins = [SELECT Account__c,Id,Name,Formula_Video_Flag__c FROM Insertion__c ]; for(Insertion__c i : Ins) { i.Formula_Video_Flag__c = 'FALSE'; } update Ins; for (Insertion__c i : Ins) { System.debug('*******Insertion*********'+i); for(Opportunity o : opp) { if(I.id == o.Insertion__c) I.Formula_Video_Flag__c = 'TRUE'; else I.Formula_Video_Flag__c = 'FALSE'; j++; } System.debug('*******Update*********'); } update Ins; } }
Can you format your code and repost it using the post code function (click the clipboard icon with the little 'c' in the middle of if)? This type of error usually means that you have embedded a SOQL query inside a loop, but its very difficult to tell based on the flattened characters.