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
learn1.3947400898749973E12learn1.3947400898749973E12 

for loop checks only the last record not the entire scope why

I am trying to update checkbox at Quote when price field at quote line items are not null. But the actual challenge is that the for loop checks only the last record not the entire scope. I mean the iteration of records not happening. Can someone pls give me some insight on this.
global class update_Quote_Chekbox implements Database.Batchable<sObject>,Database.Stateful
{
 global List<Id> QuotelineId  = new List<Id>();
   global update_Quote_Chekbox(List<Id> qlid)
   {
       QuotelineId  = qlid; //get the quote Id from the Quote LIne Item via trigger after record
                   system.debug('The qlid inside batch is'+qlid);

   }

   global Database.QueryLocator start(Database.BatchableContext BC)
   {

      string query= 'select SBQQ__Quote__c,SBQQ__ListPrice__c,SBQQ__Quote__r.Oracle_Pricing_Complete__c from SBQQ__QuoteLine__c where SBQQ__Quote__c in :QuotelineId';
      
      return Database.getQueryLocator(query);
      
   }

   global void execute(Database.BatchableContext BC, List<sObject> scope)
   {
                     
      for(Sobject s : scope)
      {
      
            
            SBQQ__QuoteLine__c lstAct = (SBQQ__QuoteLine__c)s;
                        system.debug('The scope is'+lstAct );

        
            if(lstAct.SBQQ__ListPrice__c!=NUll)
      {
         
            lstAct.SBQQ__Quote__r.Oracle_Pricing_Complete__c=true;
           // system.debug('The query is'+acr.Oracle_Pricing_Complete__c);
            update lstAct.SBQQ__Quote__r;
            }
            else{
            lstAct.SBQQ__Quote__r.Oracle_Pricing_Complete__c=false;
             update lstAct.SBQQ__Quote__r;
            }
            
      }   
      
   }
      
   


   global void finish(Database.BatchableContext BC)
   {
   }

}

 
Aleksei KosovAleksei Kosov
Could you describe your problem in more detail? I ran the same batch and he processed all the records?