From afdd2b59d25f409159bf7b787e50c4c6a617a080 Mon Sep 17 00:00:00 2001 From: p-upadhyay_sfemu Date: Fri, 10 May 2024 16:56:36 +0530 Subject: [PATCH] Update BDI_DataImportService.cls --- force-app/main/default/classes/BDI_DataImportService.cls | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls index d74c71ff653..3963becd7d8 100644 --- a/force-app/main/default/classes/BDI_DataImportService.cls +++ b/force-app/main/default/classes/BDI_DataImportService.cls @@ -624,11 +624,12 @@ global with sharing class BDI_DataImportService { this.listDI = checkRDFields(listDI); if(apexJobId != null && listDI.size() > 0) { - DataImportBatch__c batch = [SELECT Name, Batch_Number__c, Batch_Status__c, Batch_Defaults__c, + List listBatch = [SELECT Name, Batch_Number__c, Batch_Status__c, Batch_Defaults__c, Form_Template__c, RequireTotalMatch__c, Expected_Count_of_Gifts__c, Expected_Total_Batch_Amount__c, Batch_Table_Columns__c, LastModifiedDate FROM DataImportBatch__c WHERE Id= :listDI[0].NPSP_Data_Import_Batch__c LIMIT 1]; - GiftBatch giftBatch = new GiftBatch(batch); + if(listBatch.size() > 0 ){ + GiftBatch giftBatch = new GiftBatch(listBatch[0]); Boolean firstInstallmentPaid = giftBatch.shouldPayFirstInstallment(); for (DataImport__c dataImport : listDI) { @@ -640,6 +641,7 @@ global with sharing class BDI_DataImportService { } } } + } // do any performance optimizations to avoid unnecessary code disableAllOppRollups();