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

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: 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; } catch (DmlException e) { ApexPages.addMessages(e); } return pageRef ; } }




Richie DRichie D

what about this:-


try { 
          catch (DmlException e)

return null;


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)

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.