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
bathybathy 

custom object visulaforce page wizard

Hi Guys,

i have three page visulaforce wizard with a custom controller. I tried to override New button with the forst oage in th ewizard but coukdnot find the visulaforce page in the drop down list. can any one suggest a way to override new button with custom controller visualforce page or any other alternative to implement the wizard?


 
Best Answer chosen by bathy
PrabhaPrabha
I think your page looks like this:
<apex:page controller="newFactFindController" >

.
.
</apex:page>

what @Yuchen is suggesting is that add extension insted of controller, so it changes your page tag to something like this,

I guessing from your code that you are overriding new button on find fact... so

<apex:page standardcontroller="Fact_Find__c" extensions="newFactFindController" >

.
.
</apex:page>

Just save the page definition, it automatically prompts for a constructor, just click on the link, that is all you need. then you should be able to find the vf page in dropdown of new override.

HTH

All Answers

YuchenYuchen
I think in order to override the New Button with the Visualforce Page you will need to use that Object as the standardController then set some extensions for custom logic. So I think you can move the logic you have in the custom controller and set standardController for the Page.
bathybathy
Hi Yuchen,

Thanks for your quick reply.

This is my custom controller code. Life Style and financial Goals is the child object of Fact Find. I have just copied it from the salesforce opportunities wizard and customised for my requirement. I dont have much knowledge of Apex. Can you please help me how to move this to Extension? Or can you please suggest me how these wizards are implemented without overrding a standard button.

public class newFactFindController {

   // These member variables maintain the state of the wizard.
   // When users enter data into the wizard, their input is stored
   // in these variables.
  Fact_Find__c ff;
  Life_Style_and_Financial_goals__c lf;
 

   // The next four methods return one of each of the four member
   // variables. If this is the first time the method is called,
   // it creates an empty record for the variable.
 

 

     public Fact_Find__c getFf() {
     if(ff == null) ff = new Fact_Find__c();
      return ff;
    }

    public Life_Style_and_Financial_goals__c getLf() {
      if(lf== null) lf = new Life_Style_and_Financial_goals__c();
       return lf;
    }


   // The next three methods control navigation through
   // the wizard. Each returns a PageReference for one of the three pages
   // in the wizard. Note that the redirect attribute does not need to
   // be set on the PageReference because the URL does not need to change
   // when users move from page to page.
    public PageReference step1() {
      return Page.Fact_Find_Page_1;
     }

      public PageReference step2() {
       return Page.Fact_Find_Page2;
    }

    public PageReference step3() {
       return Page.FactFindPage3;
    }


   
       public PageReference cancel() {
            PageReference ffPage = new ApexPages.StandardController(ff).view();
            ffPage.setRedirect(true);
           return ffPage;
    }

   
   public PageReference save() {

      insert ff;

       lf.Fact_Find__c = ff.id;
        insert lf;

      


       PageReference ffPage = new ApexPages.StandardController(ff).view();
         ffPage.setRedirect(true);

     return ffPage;
     }

}
PrabhaPrabha
I think your page looks like this:
<apex:page controller="newFactFindController" >

.
.
</apex:page>

what @Yuchen is suggesting is that add extension insted of controller, so it changes your page tag to something like this,

I guessing from your code that you are overriding new button on find fact... so

<apex:page standardcontroller="Fact_Find__c" extensions="newFactFindController" >

.
.
</apex:page>

Just save the page definition, it automatically prompts for a constructor, just click on the link, that is all you need. then you should be able to find the vf page in dropdown of new override.

HTH
This was selected as the best answer
bathybathy
Thaks Prabha this solved my issue.