Our contact related lists on the account page layout displays records with one of the following two statuses: "Active" and "Terminated". Users are being overwhelmed with the number of terminated records within the related list and are finding it cumbersome to try and find their desired Active contact.


Either create one hide/show custom button or two custom buttons that will individual hide and show Terminated records within the related list.


I am new to creating buttons, visualforce pages, controllers, and components within SFDC and would greatly appreciate some guidance on how to tackle this project.


I have amassed all of SFDC's beginning guides to the above, but have found nothing that touches the subject of creating a button that will conditionally hide/show records. Have you done something like this before or have advice on what to do?

Thanks for your help!

  • Welcome to the Salesforce StackExchange. Thanks for all the detail in your question. It is very helpful! Mar 20, 2014 at 15:29

1 Answer 1


In this scenario, rather than creating some custom code to do that, have you considered just setting a Sort Order on the Status field to group all of your Active Contacts at the top of your related list and push your Terminated Contacts to the bottom of the list. On your page layout, there is a way to set your Sort By field for your related list.

Contact's Related List

This should solve your problem with no coding needed.

  • My initial thought on handling this task was also to sort the related list, but it did not seem to work for my predicament as I cannot make a global change. I can only a change to a specific Record Type and/or a specific Profile. Am I wildly missing something? To give you additional background: The org that I walked into proposes a unique structural design issue in that we have multiple firms using the same Org vs Org to Org sharing or other measures. A further wrench into the system is that both our external customers and internal corporate employees are using the same org.
    – Lindsey
    Mar 20, 2014 at 16:38
  • @Lindsey : were you able to fix this requirement?
    – user10727
    Sep 9, 2014 at 12:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .