• Shantanu Srivastava
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I have an apex Batch Job which gets stuck in Processing status when run on more than 20 records, say 50, but runs well if run on 20 or less records.
If the same code is run via the execute anonymous window all the records are updated successfully.
There is no error in debug logs initially but eventually an Internal Salesforce Error can be seen in logs although the Batch Job stays in Processing status.
15:31:29.539 (2539559703)|FATAL_ERROR|Internal Salesforce.com Error
Can someone please help me with what is causing this Salesforce Error?

Salesforce support suggested using transient keyword, but even that didn't work. Keeping the variables as transient is also not solving the problem. I've now removed most of the functionality, have also removed Database.Batchable. I'm clearing the main list after every update.
But still the batch job is getting stuck in Processing. This is very weird as a batch of 50 records cannot exhaust all the resources causing the entire operation to get stuck.

Thanks,
Shantanu
I have an apex Batch Job which gets stuck in Processing status when run on more than 20 records, say 50, but runs well if run on 20 or less records.
If the same code is run via the execute anonymous window all the records are updated successfully.
There is no error in debug logs initially but eventually an Internal Salesforce Error can be seen in logs although the Batch Job stays in Processing status.
15:31:29.539 (2539559703)|FATAL_ERROR|Internal Salesforce.com Error
Can someone please help me with what is causing this Salesforce Error?

Salesforce support suggested using transient keyword, but even that didn't work. Keeping the variables as transient is also not solving the problem. I've now removed most of the functionality, have also removed Database.Batchable. I'm clearing the main list after every update.
But still the batch job is getting stuck in Processing. This is very weird as a batch of 50 records cannot exhaust all the resources causing the entire operation to get stuck.

Thanks,
Shantanu
Hi all,
Can anyone help me in writting test class for this.

public class Ugcontroller {

    public String getBirthdateDOW() {
        return null;
    }


    public PageReference FindBirthdateDOW() {
        return null;
    }


 public String selectedyear{get;set;}
 public Date dat{get;set;}
 public ID ugId{get;set;}
 

  public UnderGradute__c ugform{
    get {
      if (ugform== null)
       ugform = new UnderGradute__c();
       
      return ugform;
    }
    set;
  }
  
  
  
    public PageReference Ugpage4() {
        return page.UG_page4;
    }
    
    
    public PageReference ugpage3() {
        return page.UG_page3;
    }
    
    
    public PageReference ugpage2() {
        return page.UG_page2;
    }


    public PageReference ugpage1() {
        return page.UG_Page1;
    }



    
     public Ugcontroller () {
    
      
  }
  
  
    public class Sampledate {
            
            public Sampledate() {
        
            }
       }
    
public List<SelectOption> getyearOptions() {
        List<SelectOption> countryOptions = new List<SelectOption>();
        countryOptions.add(new SelectOption('','-None-'));
        
        for(integer i=2016;i<=2022;i++)
        {
        string s = string.valueof(i);
        countryOptions.add(new SelectOption(s,s));
        }
        
        return countryOptions;
    } 

    public PageReference cancel() {
        return null;
    }

    public PageReference save() {
    system.debug(this.ugform);
    
           try {
      ugform.Year_Enrollment__c = String.valueOf(selectedyear);
      ugform.Date_of_Birth_ug__c = Date.valueof(dat);
      upsert ugform;
     
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error creating new Undergraduate.'));
      return null;
    }
     Pagereference ref = new Pagereference('/apex/UG_congrats?id=' +ugform.id);

              ref.setRedirect(true);
            
         // if successfully inserted new lform, then displays the thank you page.
           return ref;
        
    }
            public PageReference getpdfpage() {
  this.ugId = ApexPages.currentPage().getParameters().get('id');
  Pagereference ref = new Pagereference('/apex/UG_PDF_Page?id=' +this.ugId);

              ref.setRedirect(true);
            
         // if successfully inserted new lform, then displays the thank you page.
           return ref;      
    }
    
    public with sharing class ExamplePageController {

    public ExamplePageController(Ugcontroller controller) {

    }

  public UnderGradute__c ugform{get; set;}
  public String StringDate {get; set;}
  public String StringDateDOW {get; set;}
  public String BirthdateDOW {get; set;}
  
  // create a temporary contact 
  public ExamplePageController() {
   
    ugform = new UnderGradute__c();
  }
  
  // find the day of the week for Birthdate.  Date.valueOf can be used with Date fields
  public PageReference FindBirthdateDOW() {
    try {
      BirthdateDOW = DateTime.newInstance( Date.valueOf(ugform.Date_of_Birth_ug__c), Time.newInstance(0, 0, 0, 0) ).format('EEEE');
    } catch (exception e) {
      BirthdateDOW = '';
    } 
    return null;
  }
  
}

}