function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
osamaosama 

Receiving DML error

Hi,
  I am recieving the following error in my debug log.
Database.Database.Error[getFields=(Status);getMessage=null;getStatusCode=System.StatusCode.FAILED_ACTIVATION;]
[getFields=(Status);getMessage=null;getStatusCode=System.StatusCode.FAILED_ACTIVATION;]
Can anyone explain me this?
Below is the Apex code on which this is coming
try
{
 String s = '006T00000037DqM';
  Opportunity opp=[select Id,CloseDate,AccountId,Account_Manager__c,Agency_Commision__c,Agreement_Terms__c,Auto_Renewal__c,Average_CPC__c,Below_Discrepancy_Billing_Based_On__c,Billing_Based_On__c,Billing_Instruction__c,Bool_Net_Value__c,Broker_Commision__c,Budget_Allocation__c,Business_Unit__c,CPC_Target_Avg__c,CPC_Target_Max__c,CPC_Target_Min__c,Campaign_Manager__c,Campaign_Total__c,Cancellation_Conditions__c,Cancellation_Period__c,Change_Description__c,Change_Type__c,Client_PO_No__c,Closure_Chance__c,Contract_Months__c,Contract_User_Id__c,Contract_User__c,Creative_Received__c,CurrencyIsoCode,Delivery_Commision__c,Description,Discrepancy_Clause_Base__c,Discrepancy_Clause_Remarks__c,Discrepancy__c,Does_publish_objectionable_content__c,Does_target_teenagers__c,Effective_Date__c,End_Date__c,Fee_Total__c,Final_Creative_Due_Date__c,Form_of_Agreement__c,GST__c,I_O_Ref_Name__c,Installation_Type__c,Invoice_Start_Date__c,Invoice_To__c,Invoicing_Cycle__c,Invoicing_Terms__c,Is_a_downloadable_application__c,Is_a_gaming_   application__c,Is_a_wireless_application__c,Kick_Off_Meeting_Date__c,Liability_To__c,List_Owner_Commision__c,Mailing_Seed_Names__c,Marketing_Tag__c,Max_Monthly_Budget__c,Maximum_Average_Bid__c,Maximum_CPC__c,Maximum_Monthly_Budget__c,Minimum_CPC__c,Modules__c,Monthly_Impressions__c,Monthly_Traffic_Target_Avg__c,Monthly_Traffic_Target_Max__c,Monthly_Traffic_Target_Min__c,Name,Net_Amount__c,No_GST__c,No_of_Trained_Employees__c,Online_Reporting_Access__c,Order_No__c,Original_Net_Value__c,OwnerId,Owner_Region__c,Pay_Per_Performance_Rate__c,Payment_Period__c,Payment_Terms__c,Planed_Order_End_Date__c,Planed_Order_Start_Date__c,Project_Management_Fee__c,Reasons_if_Lost__c,RecordTypeId,Referrer_Code__c,Region__c,Reporting_Login__c,Reporting_Password__c,Reporting_URL__c,Start_Date__c,Target_Drop_Date__c,Target_URL__c,Term__c,Territory__c,Third_Party_Ad_Server__c,Third_Party_Ad_Serving__c,Total_Booked_Clicks__c,Total_Booked_Impressions__c,Total_Budget__c,Total_Discount__c,Total_Media_Spend__c,Trained_For_Free__c,Training_Facility__c,Trial_Period__c,VAT_Percentage__c,Version__c from Opportunity where Id=:s ];
  
        Contract con = new Contract (name=opp.Name,AccountId=opp.AccountId,Order_No__c=opp.Order_No__c,Opportunity_Id__c=opp.Id);
    
    Database.SaveResult MySaveResult =Database.insert(con,false);
    msg='Contract' + MySaveResult.getId();
    String NewContract  =  MySaveResult.getId();
    Integer i = 0;
      List<Contract_Campaign__c> MD  = new List<Contract_Campaign__c>();
   
   for (Media_Campaign__c tmp:[select Id,name,Booked_Qty__c,Budget__c,Buy_Type__c,Campaign_ID__c from Media_Campaign__c where Opportunity__c =: opp.Id])
   {
    Contract_Campaign__c con1 = new Contract_Campaign__c (Contract__c= NewContract,name=tmp.name);
    
    MD.add(con1);
    i=i+1;
   }
          
          Database.SaveResult[] MySaveResult1 =Database.insert(MD,false);
      System.Debug(MySaveResult1);
     for(Database.SaveResult sr:MySaveResult1)
   {
     if(!sr.isSuccess())
    { Database.Error err = sr.getErrors()[0];
      System.Debug(err);
    }     
   }
   
   
   insert MD;
  }
         
            catch (DmlException e) { System.debug(e.getMessage());}
 
Thanks
Usama.