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
TechSteveTechSteve 

redirect from vf page on save

Hi all, I need to redirect from a customvf page to another when the save action has occurred. It is a custom object and the normal save is working fine but i need this redirect. I found this example on the boards which has been marked as the solution but when i try to use it it tells me :

System.NullPointerException: Attempt to de-reference a null object
Class.SISEdit.saveandnotes: line 50, column 1 

 Anyone got any ideas whats up?

 

     public PageReference saveandnotes() {
          controller.save(); // This takes care of the details for you.
          PageReference ProgressNotes = Page.PN;
          ProgressNotes.setRedirect(true);
        return ProgressNotes;
    } 

Best Answer chosen by Admin (Salesforce Developers) 
Rahul SharmaRahul Sharma

This error occurs when you used the object / list without initializing or assign a value to value which is null.

Check the code in save method and assure you are initilizing the object/list before using.

post the save method code if it doesn't help.

All Answers

Rahul SharmaRahul Sharma

This error occurs when you used the object / list without initializing or assign a value to value which is null.

Check the code in save method and assure you are initilizing the object/list before using.

post the save method code if it doesn't help.

This was selected as the best answer
TechSteveTechSteve

Thanks realised that i wasn't initialising it properly.

 

Thanks again.