You need to sign in to do that
Don't have an account?

Getting Error at First update line in the following code
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; } }
Is this your exact code ?? if so then the please correct the syntax of the first property declared..
It should be
Can you post your formatted code (using the clipboard icon with the little 'c' in the middle). Its pretty difficult to understand the flattened code and you'll probably get a better response if the contributors don't have to reformat it themselves.
public class UpdateFieldOnOpportunity {
public List <Opportunity> Opp {set; get;}
Public List<Insertion__c> Ins { set; get; }
public Integer j = 0;
public void updateValues()
{
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;
}
}
Getting error at first update statement. It is out side of the for loop only but still getting error in production environment.