• Sravan Gupta
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

global with sharing class Update_Contract_Changed_this_week_Field implements Schedulable {

global list<Contract_Cycle_Discussion__c> AllContracts;
public Update_Contract_Changed_this_week_Field ()
{

}

global void execute(SchedulableContext SC)
{
allcontracts = [ SELECT Additional_Sales_Director_Difference__c,Additional_Sales_Director_Shadow__c,
Additional_Sales_Director__c,Advertiser_Contact_Difference__c,Advertiser_Contact_Shadow__c,
Advertiser_Contact__c,Advertiser_Difference__c,Advertiser_Shadow__c,Advertiser__c,
Agency_Contact_Difference__c,Agency_Contact_Shadow__c,Agency_Contact__c,Agency_del_Difference__c,
Agency_del_Shadow__c,Agency_del__c,Background_Notes_Difference__c,Background_Notes_Shadow__c,
Background_Notes__c,BOR_Special_Rate_Correct_Difference__c,BOR_Special_Rate_Correct_Shadow__c,
BOR_Special_Rate_Correct__c,Brand_Difference__c,Brand_Exclusion_Difference__c,Brand_Exclusion_Shadow__c,Brand_Exclusion__c,Brand_Shadow__c,Brand__c,Category_Discount_Highest_Level_Shadow__c,
Category_Discount_Highest_Level__c,Category_Discount_Planning_Rate_Shadow__c,Category_Discount_Planning_Rate__c,
Category_Discount_Proposal_Contract_S__c,Categ_Discount_Highest_Level_Difference__c,Categ_Discount_Planning_Rate_Difference__c
,Categ_Disc_Proposal_Contr_S_Difference__c,Categ_Disc_Proposal_Contr_S_Shadow__c,Close_Date_Difference__c,Close_Date_Shadow__c,
Close_Date__c,Contract_Changed_this_week_FLAG__c,Contract_Date_Issued_Difference__c,Contract_Date_Issued_Shadow__c,
Contract_Date_Issued__c,Contract_Date_Signed_Difference__c,Contract_Date_Signed_Shadow__c,Contract_Date_Signed__c,
Contract_External_ID_Difference__c,Contract_External_ID_Shadow__c,Contract_External_ID__c,Contract_Notes_Difference__c,
Contract_Notes_Shadow__c,Contract_Notes__c,Contract_Status_Difference__c,Contract_Status_Shadow__c,
Contract_Status_Update_Difference__c,Contract_Status_Update_Shadow__c,Contract_Status_Update__c,Contract_Status__c,
Contract_Type_Difference__c,Contract_Type_Shadow__c,Contract_Type__c,CreatedById,CreatedDate,Current_User__c,
Digital_Discount_Highest_Level_Shadow__c,Digital_Discount_Highest_Level__c,Digital_Discount_Planning_Rate_Shadow__c,
Digital_Discount_Planning_Rate__c,Digital_Discount_Proposal_Cont_Sign_On__c,Digital_Disc_Highest_Level_Difference__c,
Digital_Disc_Planning_Rate_Difference__c,Digit_Disc_Propos_Cont_Sign_On_Shadow__c,Digit_Disc_Prop_Cont_Sign_On_Difference__c,
Division_Difference__c,Division_Shadow__c,Division__c,End_Date_Difference__c,End_Date_Shadow__c,End_Date__c,
Estimated_Net_Revenue_Difference__c,Estimated_Net_Revenue_Shadow__c,Estimated_Net_Revenue__c,
Estimate_Advert_Fiscal_Year_Difference__c,Estimate_Advert_Fiscal_Year_Shadow__c,Estimate_Advert_Fiscal_Year__c,
Estimate_App_Fiscal_Year_Difference__c,Estimate_App_Fiscal_Year_Shadow__c,Estimate_App_Fiscal_Year__c,
Estimate_Print_Fiscal_Year_Difference__c,Estimate_Print_Fiscal_Year_Shadow__c,Estimate_Print_Fiscal_Year__c,
Estimate_Total_Contract_Year_Difference__c,Estimate_Total_Contract_Year_Shadow__c,Estimate_Total_Contract_Year__c,
Estimate_Total_Fiscal_Year_Difference__c,Estimate_Total_Fiscal_Year_Shadow__c,Estimate_Total_Fiscal_Year__c,
Estimate_Web_Fiscal_Year_Difference__c,Estimate_Web_Fiscal_Year_Shadow__c,Estimate_Web_Fiscal_Year__c,Final_Approver_Difference__c,
Final_Approver_Shadow__c,Final_Approver__c,Highest_Amount_Difference__c,Highest_Amount_Shadow__c,Highest_Amount__c,
Highest_Level_CPM_Difference__c,Highest_Level_CPM_Shadow__c,Highest_Level_CPM__c,Id,Includes_Other_Incentives_Difference__c,
Includes_Other_Incentives_Shadow__c,Includes_Other_Incentives__c,Includes_SOM_Difference__c,Includes_SOM_Shadow__c,Includes_SOM__c,
Insert_Discount_Highest_Level_Shadow__c,Insert_Discount_Highest_Level__c,Insert_Discount_Planning_Rate_Difference__c,Insert_Discount_Planning_Rate_Shadow__c,Insert_Discount_Planning_Rate__c,Insert_Discount_Proposal_Contract_Sig__c,Insert_Disc_Proposal_Contract_Sig_Shadow__c,Insert_Disc_Propos_Contr_Sig_Difference__c,IsDeleted,LastActivityDate,LastModifiedById,LastModifiedDate,Media_Services_Difference__c,Media_Services_Shadow__c,Media_Services__c,Name,Name_Difference__c,Name_Shadow__c,Planning_Rates_Difference__c,Planning_Rates_Shadow__c,Planning_Rates__c,Primary_Corporate_Sales_Director_Shadow__c,Primary_Corporate_Sales_Director__c,Primary_Corp_Sales_Director_Difference__c,Proposal_Date_Issued_Difference__c,Proposal_Date_Issued_Shadow__c,Proposal_Date_Issued__c,RecordTypeId,Rob_Discount_Highest_Level_Difference__c,Rob_Discount_Highest_Level_Shadow__c,Rob_Discount_Highest_Level__c,ROB_Discount_Planning_Rate_Difference__c,ROB_Discount_Planning_Rate_Shadow__c,ROB_Discount_Planning_Rate__c,Rob_Discount_Proposal_Contract_Sign_O__c,Rob_Disc_Proposal_Contract_Sign_O_Shadow__c,Rob_Disc_Proposal_Cont_Sign_O_Difference__c,Secondary_Corporate_Sales_Director__c,Secondary_Sales_Director_Difference__c,Secondary_Sales_Director_Shadow__c,Sign_On_CPM_Difference__c,Sign_On_CPM_Shadow__c,Sign_On_CPM__c,Sign_On_Difference__c,Sign_On_Shadow__c,Sign_On__c,Start_Date_Difference__c,Start_Date_Shadow__c,Start_Date__c,SystemModstamp,Two_Year_Deal_Difference__c,Two_Year_Deal_Shadow__c,Two_Year_Deal__c,Insert_Discount_Highest_Level_Difference__c FROM Contract_Cycle_Discussion__c]; // where Committed_Date__c != null

if( allcontracts != null && allcontracts.size() > 0)
{
System.debug('*********Size****'+allcontracts.size());
for(Integer i=0; i < allcontracts.size();i++)
{
if( allcontracts.get(i).Media_Services_Difference__c == 'DIFFERENCE' ||
allcontracts.get(i).Primary_Corp_Sales_Director_Difference__c == 'DIFFERENCE' ||
allcontracts.get(i).Additional_Sales_Director_Difference__c == 'DIFFERENCE' ||
allcontracts.get(i).Secondary_Sales_Director_Difference__c == 'DIFFERENCE' ||
allcontracts.get(i).Agency_del_Difference__c == 'DIFFERENCE' || allcontracts.get(i).Start_Date_Difference__c == 'DIFFERENCE'
|| allcontracts.get(i).End_Date_Difference__c == 'DIFFERENCE' || allcontracts.get(i).ROB_Discount_Planning_Rate_Difference__c != 0 ||
allcontracts.get(i).Categ_Discount_Planning_Rate_Difference__c != 0 || allcontracts.get(i).Insert_Discount_Planning_Rate_Difference__c != 0 || allcontracts.get(i).Digital_Disc_Planning_Rate_Difference__c != 0 || allcontracts.get(i).Proposal_Date_Issued_Difference__c == 'DIFFERENCE' || allcontracts.get(i).Sign_On_Difference__c != 0

|| allcontracts.get(i).Rob_Disc_Proposal_Cont_Sign_O_Difference__c != 0
|| allcontracts.get(i).Categ_Disc_Proposal_Contr_S_Difference__c != 0 ||
allcontracts.get(i).Insert_Disc_Propos_Contr_Sig_Difference__c != 0 ||
allcontracts.get(i).Digit_Disc_Prop_Cont_Sign_On_Difference__c != 0 || allcontracts.get(i).Includes_SOM_Difference__c == 'DIFFERENCE' ||
allcontracts.get(i).Includes_Other_Incentives_Difference__c == 'DIFFERENCE' ||
allcontracts.get(i).Sign_On_CPM_Difference__c != 0
|| allcontracts.get(i).Highest_Amount_Difference__c != 0
|| allcontracts.get(i).Rob_Discount_Highest_Level_Difference__c != 0 ||
allcontracts.get(i).Categ_Discount_Highest_Level_Difference__c != 0 ||
allcontracts.get(i).Insert_Discount_Highest_Level_Difference__c != 0 ||
allcontracts.get(i).Digital_Disc_Highest_Level_Difference__c != 0 ||
allcontracts.get(i).Highest_Level_CPM_Difference__c != 0 ||
allcontracts.get(i).Two_Year_Deal_Difference__c == 'DIFFERENCE' ||
allcontracts.get(i).Final_Approver_Difference__c == 'DIFFERENCE' ||
allcontracts.get(i).Contract_Type_Difference__c == 'DIFFERENCE' ||
allcontracts.get(i).Contract_Status_Update_Difference__c == 'DIFFERENCE'||
allcontracts.get(i).Contract_Date_Issued_Difference__c == 'DIFFERENCE' ||
allcontracts.get(i).Contract_Date_Signed_Difference__c == 'DIFFERENCE'
)
{
allcontracts.get(i).Contract_Changed_this_week_FLAG__c = 'CHANGED';


}
else
{
allcontracts.get(i).Contract_Changed_this_week_FLAG__c = 'UNCHANGED';

}
update allcontracts;
}
}
}

}

Getting the below error with the above code.please help me on this

 

12:30:29.452 (209452055000)|CODE_UNIT_FINISHED|Workflow:01I30000002Fje8
*********** MAXIMUM DEBUG LOG SIZE REACHED ***********
12:31:15.459 (255459867000)|FATAL_ERROR|System.LimitException: Too many DML rows: 10001

Class.Update_Contract_Changed_this_week_Field.execute: line 85, column 1
  • January 07, 2013
  • Like
  • 0