I've got a method that redirects to another page. It does work this way:
public PageReference redirectToSetup() {
return Page.SetupPage;
}
and this way:
public PageReference redirectToSetup() {
PageReference page = new PageReference('/apex/SetupPage');
page.setRedirect(true);
return page;
}
but not his way:
public PageReference redirectToSetup() {
PageReference page = Page.SetupPage;
page.setRedirect(true);
return page;
}
I'me getting the following error when trying to save it:
Error: Compile Error: Variable does not exist: Page.SetupPage
What am I doing wrong? Documentation here is using the same pattern, isn't it?