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
dhcrusoedhcrusoe 

Redirecting up a {!save} w/ controller extension

Hi all,

 

Thanks for your help - many times in the past! I'm trying to redirect a user once a form has been saved... following the code example in the Developer's guide (p.393), but I'm getting an error:

 

Class.appLessonExtension.save: line 27, column 22 External entry point 

 

with this controller extension, which seems to be correct to me? 

 

 

public class appLessonExtension { private final Lesson_Plan__c lessonplan; private final ApexPages.standardController theController; ... public PageReference save() { PageReference pageRef = new PageReference('CTN_Apprenticeship'); pageRef.setRedirect(true); try { return theController.save(); } catch (DmlException e) { ApexPages.addMessages(e); } return pageRef ; } }

 

 

 

Richie DRichie D

what about this:-

 

try { 
              theController.save();
          }
         
          catch (DmlException e)
          {
              ApexPages.addMessages(e);

return null;
          }

R.

dhcrusoedhcrusoe
Hmm.... thanks for the suggestion, but I'm still getting the same error. We're trying some other tricks & will post if it gets fixed... all this craziness just to save some fields and redirect to a new page? Oh, how I miss php :o)
ATSATS

Is CTN_Apprenticeship a VF page?  If so I think it'd be:

 

PageReference pageRef = Page.CTN_Apprenticeship

 

If non-VF page then:

 

PageReference pageRef = new PageReference('/CTN_Apprenticeship')

 

 

Hope that helps.