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
Sushma  RamakrishnanSushma Ramakrishnan 

Displaying List Views based on condition using VF page

Hi All,

I have a object Test which has two list views say ListView 1 and ListView2.
In object Test I have a field based on the value (YES or NO) need to display the user either of the list view on tab click.
Currently I am displaying only one listview on tab click using the below :
<apex:page showHeader="true" tabStyle="Test_c" action="/a1t?fcf=00BP0000000WMHv" ></apex:page>
Now need to add condition to it.Please Help...

Thanks in Advance for Any Help...!
Martijn SchwarzerMartijn Schwarzer
Hi Sushma,

You can create a custom VF page which includes an <apex:enhancedList>. In this enhancedlist you can set the listview to be used.

For more information, please check the following article:

Based on the value in your object, you can render the correct listview.

Hope this helps!

Best regards,
Martijn Schwärzer

Ps. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Navee RahulNavee Rahul
Hello Shusma ,

what you can do is using <apex:outpanel> you check condtions
<apex:outputpanel rendered="{!showuser==true}" >

  Related list of users
  <apex:relatedList />

by using above code,Related list will be shown only when showuser variable is true

by using output panel you can check conditions and display.

D Naveen rahul.
Try doing something like this :
<apex:page showHeader="true" tabStyle="Test_c" action="{!IF(<field> == 'Yes', '/a1t?fcf=00BP0000000WMHv', 'somethingelse')}" ></apex:page>