+ Start a Discussion
Victor19Victor19 

Custom View Button to dynamically display visualforce pages

Hi,

 

I am trying to override the view button in custom object with a custom view button. My custom button should dynamically display visualforce pages based on  a field value.

 

For eg: I have two Visualforce Pages: VF1 and VF2 and a picklist - testpick__c = 1;2

 

If the record has testpick__c = 1 --> Display VF1 when custom view button is clicked

If the record has testpick__c = 2 --> Display VF2 when custom view button is clicked

 

It would greatly help me out if someone could share some code or suggest an approach that I could use to implement this functionality.

 

Thanks!

Dave Miller.ax1920Dave Miller.ax1920
Go to VF1. use the action= in the apex:page to do the test in the controller and redirect to VF2 if needed
Ashish_SFDCAshish_SFDC

Hi Victor, 

 

I think you should look at using a single controller and by setting setRedirect(false), so that the data persists between the calls and using the updated data the 2nd page can be shown or redirected to. You may want to refer to the following URL for more details :

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_controller_navigation_methods.htm

 

Regards,

Ashish