Answers for "batch apex list of custom object in apex salesforce"

0

batch apex list of custom object in apex salesforce

global class batchTestNew implements Database.Batchable<sObject>{

public List <Contact> accountsToParseSet = new List<Custom_Object__c>();

   global batchTestNew(List<Custom_Object__c> accountsToParseGet){
   accountsToParseSet = accountsToParseGet;          
   }

   global Database.QueryLocator start(Database.BatchableContext BC){
      return accountsToParseSet;
   }

   global void execute(Database.BatchableContext BC, 
                       List<sObject> scope){
      for(sObject s : scope){
           upsert accountsToParseSet;
                  }      
      update scope;
   }

   global void finish(Database.BatchableContext BC){

   }

}
Posted by: Guest on May-23-2020

Browse Popular Code Answers by Language