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
Ken KoellnerKen Koellner 

Same VF Page from three buttons, how to tell which button was pressed

I want to have three custom list buttons that all go to the same VF page the has a controller extension that uses standardSetController.

 

I'd like to have the page contents vary slightly based on which button was pressed and have slightly different action.

 

I don't know if there's a way to pass which button was pressed or some other mechanism to find out which button was pressed.

 

I considered having a three very smaller wrapper pages each withslightly different content that all use the same controller.  Then put the majority of the contents in the custom components.  But custom components have a lot of restrictions.  For example, you can't declarea a pageBlockTable without a pageBlock but I'd want the pageBlock in the outer page for certain design reasons.  Also, I want the controller used declared at the page level.  I could pass in merger variables as attributes of the components but not action methods.  I know there is a way to share controllers between components and pages but it's horrendously complicated (way more than it should be in my opinion.)

 

Best Answer chosen by Admin (Salesforce Developers) 
kamlesh_chauhankamlesh_chauhan

Try below solution that might work.

 

In your list buttons, Use content source as URL rather than visualforce page. Add the different query string parameter to each button URLs to identify the button click.

 

Hope this helps.

 

Regards,

Kamlesh Chauhan, (Founder & CTO)

LogicRain Technologies, (Salesforce and Force.com Development Division)

Cellular: +91-(997) 476-6800 Office: (732) 676-6400 Skype:kamlesh.logicrain

kamlesh@logicrain.com || http://www.logicrain.com || LinkedIn

 

Answers/Suggestions are my own.
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

 

 

 

All Answers

kamlesh_chauhankamlesh_chauhan

Try below solution that might work.

 

In your list buttons, Use content source as URL rather than visualforce page. Add the different query string parameter to each button URLs to identify the button click.

 

Hope this helps.

 

Regards,

Kamlesh Chauhan, (Founder & CTO)

LogicRain Technologies, (Salesforce and Force.com Development Division)

Cellular: +91-(997) 476-6800 Office: (732) 676-6400 Skype:kamlesh.logicrain

kamlesh@logicrain.com || http://www.logicrain.com || LinkedIn

 

Answers/Suggestions are my own.
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

 

 

 

This was selected as the best answer
Ken KoellnerKen Koellner

I did just as you suggest as an experiment and it indeed worked.


I didn't initially try that as I wasn't sure the selected list of record would still get passed to the page.

 

-Ken

 

kamlesh_chauhankamlesh_chauhan

Great. Thanks