• NANDHINI k 9
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
public with sharing class LeaveTriggerHelper {
    public static void createTotalLeave(List<Employee_Detail__c> EmpList){
     
      List<Leaves__c> LeaveList = new List<Leaves__c>();
      for (Leaves__c obj: EmpList) {
         
         if (obj.Approval_Status__c == 'Approved')
            {
             // condition to check the old value and new value
            Leaves__c objLeave = new Leaves__c();   //To get the total leave value is separating from(EmpList) No.of.available.Leave and LeaveTaken(Leaves)
            obj.Total_Leave__c=EmpList.No_of_available_Leave__c - obj.Leave_Taken__c;        
            LeaveList.add(objLeave);
         }
      }
     
      insert LeaveList;  // DML to insert the Invoice List in SFDC
   }
}
global class UpdateTheValue implements Database.Batchable<Employee_Detail__c>
{
   global final String Query;
   global integer Available_Leave__c;
global SummarizeAccountTotal(String q)
{
       Query=q;
   }

   global Database.QueryLocator start(Database.BatchableContext BC){
      return Database.getQueryLocator(query);
   }
   
   global void execute(Database.BatchableContext BC,List<Employee_Detail__c> scope){
      for(Employee_Detail__c s : scope)
      {
         Available_Leave__c= Integer.valueOf(s.get('Available_Leave__c'))+4;
      }
       update scope;
   }

global void finish(Database.BatchableContext BC){
   }
}

Error:class UpdateTheValue must be implement method:system.iterable Database.Batchable.start.(Database.batchablecontext)