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
SirTravSirTrav 

visualforce with multiple extensions

When talking to another developer today we came across a question that we can't find the answer to so I was hoping someone here knew the answer.  I know that you can create a visualforce page with more than one extension.  My questions are:

1. Why would you use more than one?

2. If you have more that one in what order does visualforce look for your method?

3. What happens if you have a method with the same name on different extensions?

Best Answer chosen by Admin (Salesforce Developers) 
nickwick76nickwick76

Hi,

 

  1. You want to extend a controller with different types of behaviour already implemented in separate Apex classes. Instead of creating one big class you extend them separately keeping it simple and easy to maintain
  2. left to right
  3. leftmost overrides

Read more here -> http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_extension.htm

 

HTH / Niklas

All Answers

nickwick76nickwick76

Hi,

 

  1. You want to extend a controller with different types of behaviour already implemented in separate Apex classes. Instead of creating one big class you extend them separately keeping it simple and easy to maintain
  2. left to right
  3. leftmost overrides

Read more here -> http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_extension.htm

 

HTH / Niklas

This was selected as the best answer
SirTravSirTrav
Thank you. That was very helpful.
Brooke HarperBrooke Harper
Thank you for answering this nickwick76! I've been looking for this post for hours.
Praveen Srivastav 6Praveen Srivastav 6
Thank you Nick: just wanted to know if I want to change the order of execution of Extesnion how to do it