salesforce override related list button

For overriding a related list button we have to use standard list controller. The syntex used in defining this standard list controller is same as standard controller. That is, we need not write it as standardlistcontroller in page tag, but we have to use "recordSetVar"  attribute. This variable indicates that the standard controller is a list controller. Also this variable can be used to access the selected record in related list.
To use standard list controller define the page attribute as below (example on contact)
 
<apex:page standardController="Contact" recordSetVar="LisRecs" extensions="relatedListoverideController">
In the following example a "list button" created on contact is overridden with following visualforce page that shows the selected contact records in related list (example contact related list on a account record)
Visualforce page
Controller

8 comments:

  1. nice post...any thoughts on how to override the List button ?

    ReplyDelete
    Replies
    1. List button is same as related list button, recordsetvar is required for overiding the list button. The above post is for list button overriding.

      Delete
  2. I have over ridden the list custom button, but I am not getting any result?

    ReplyDelete
  3. How to run this can you please explain? I too stuck :(
    What I did:
    1. I copy pasted your code.
    2. I have created alist button in Contact.
    3. From the list view page I am trying to run the page by hitting the newly created List button.

    ReplyDelete
    Replies
    1. make sure you have selected the contacts before pressing the button.

      Delete
  4. Thanks..it works now!!!

    ReplyDelete
  5. Shall we talk....JK and my email id jk.salesforce@intellicloudware.com
    or please send me your profile or send me a request to my skype id:janny.kandala

    ReplyDelete
  6. Shall we talk....JK and my email id jk.salesforce@intellicloudware.com
    or please send me your profile or send me a request to my skype id:janny.kandala

    ReplyDelete