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

Visualforce Error..Help!

Hi All,


I am new to Salesforce and I keep getting this error message and have no idea how to fix it. Any ideas?


System.NullPointerException: Attempt to de-reference a null object 


Class.NewGroupSeasonController.execute: line 27, column 91 External entry point






please write the code too


Code Sample:


public void execute(){

  //Apply the number and season of the current group to the number and season variables
  this.currentGrpNumber = this.currentGrp.Group_Number__c;
  this.currentGrpSeason = this.currentGrp.Season__c;
  //Integer currentGrpNoInt = this.currentGrpNumber;
  //Update current group so that the name is "Group _ - Season _" instead of Active, remove active checkbox
  String updatedOldGrpName = 'Group ' + this.currentGrpNumber.intvalue() + ' - Season ' + this.currentGrpSeason.intvalue();
  this.currentGrp.Name = updatedOldGrpName;
  this.currentGrp.Active__c = False;
  update this.currentGrp;
  //If next season's group already exists, change name and Active checkbox
  for(Executive_3D_Group__c next:[Select Name, Group_Number__c, Season__c, Active__c from Executive_3D_Group__c where
                                  Group_Number__c = :this.currentGrpNumber AND Season__c = :(this.currentGrpSeason + 1) limit 1]){
    String activeName = 'Group ' + this.currentGrpNumber + ' - Active';
    next.Name = activeName;
    next.Active__c = true;
    update next;

Prafull G.Prafull G.



only method does not show correct line of error.

However, viewing the code shows that the exception might be at line


String updatedOldGrpName = 'Group ' + this.currentGrpNumber.intvalue() + ' - Season ' + this.currentGrpSeason.intvalue();


The reason is that the value this.currentGrpNumber or this.currentGrpSeason is null. You have to handle null cases.

You can write something as

if(this.currentGrpNumber != null){

  // do your stuff



with best,


Ankit AroraAnkit Arora

If the problem is still not resolved can you please provide a bit more code snippets, or just highlight the code line which is causing error.



Ankit Arora