+ Start a Discussion

Visual Force Listviews - action on a list button.

I have a VF page that takes the id of an object. I want to display another listview which has a list view button on it. I want to be able to pass the original id when button is clicked. How do I do it.


So my VF page is accessed using /apex/myVFPage?id=0017000000OSuub


My VF page code looks like follows:



<apex:page Controller="myVFPageController">
<apex:listViews type="Contact"/> 



On my Contacts List View, I have added a button "Do Something".


When the user clicks "Do Something", I want to link these contacts with the id I passed in VF page (0017000000OSuub). How do I pass this ID to the code the handles the "Do Something" button?






The only way that I can think of to accomplish what you want that I can think of would be to make use of APEX webservices called from the javascript of the custom button. You would probably have to attempt to grab the id within the javascript, then you could pass that into a custom defined APEX webservice.


Here's a link to another forum post, relating to calling APEX from custom buttons: http://community.salesforce.com/t5/Apex-Code-Development/How-to-call-APEX-code-in-a-custom-button/m-p/141438