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
Janno RipJanno Rip 

apex:relatedList - render only when records exist on subject

Hello Developers,

I have a custom object (Leadevents__c), that is linked via lookup to accounts. The following visualforce page code shows me a specific related list (open tasks) from that account on my custom object
 
<apex:page standardcontroller="Leadevents__c"> 
<base target="_top"/> 

<apex:relatedList id="OpenTask_acc" pageSize="3" subject="{!Leadevents__c.Account__c}" list="OpenActivities" />

</apex:page>
Is there any chance to display the list only if there are actually records in the account related list? If there are no open tasks on the account, the related list should not be display on my custom object.

Thanks!