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
Anvesh PaidakulaAnvesh Paidakula 

Please correct this below code from exception ?

For the below code i am getting Limit exception while deploying into production. I knw  more tham 10k records are processed in querry...can anyone correct this ......


@isTest private static void FT_FT()
    {
      List<Transaction__c> TList = new List<Transaction__c>();
      Transaction__c F = GenTransactionForecare(1000, '', FORECARE_CU);
      Transaction__c F2 = GenTransactionForecare(1002, '', FORECARE_CU);

      TList.add(F);
      TList.add(F2);

      Test.startTest();
      insert TList;
      Test.stopTest();
   
      Map<Id, Transaction__c> TMap = new Map<Id, Transaction__c> ([SELECT External_Wholesaler__c, Id FROM Transaction__c WHERE
      Id =:F.Id OR Id =:F2.Id]);
   
//Exception occurerd getting Too Many Soql  statements
 

      System.assertEquals(true, TMap.get(F.Id).External_Wholesaler__c != null && TMap.get(F2.Id).External_Wholesaler__c != null,
        'TMap.get(F.Id).External_Wholesaler__c: '+TMap.get(F.Id).External_Wholesaler__c+
        ' . TMap.get(F2.Id).External_Wholesaler__c: '+TMap.get(F2.Id).External_Wholesaler__c);

    }
}
MagulanDuraipandianMagulanDuraipandian
Write this separate test class and then run it.

If this solves your problem, kindly mark it as the best answer.

Regards,
Magulan
http://www.infallibletechie.com