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
sreenathsreenath 

Hide records in related list

Hi developers,

                         It's really a challenge thinking....i want to hide child records & again i want to show the records in the relatedlist for a parent object. No relationship should be deleted for this scenario...

 

Any Idea from side it's helpful

 

Thanks

Sreenath

vishal@forcevishal@force

Hi,

 

You can do that on a visualforce page using <apex:relatedList>

 

User the RENDERED attribute to show and hide any related list based on the conditions.

sreenathsreenath

Hi vishal,

              You are suggesting to hide the related list ...correct? 

 

No,  I want to hide related list records. But, not the related list. If related list contains 4 records i want to hide 1 record in the related list without removing association of parent - child relationship. 

 

Thanks

sreenath

neophyteneophyte

What Vishal meant was - you should remove the standard related list from the layout. Add a visualforce page in the page layout. The VF page should designed to look like a related list. Since its a custom page, you can control the records to be displayed using the logic in the controller.

vishal@forcevishal@force

Yup, that's exactly what I meant.

 

Because, what you want to achieve can not be done on a Standard Page. Related lists don't have any filters.

sreenathsreenath

Hi Anand & Vishal,

                     Thanks for your quick response. please provide any solution you have similar to this req as a code.

 

Thanks

Sreenath

SFFSFF

You might be able to use criteria-based sharing rules, if you can define universal rules that apply for all users.

 

For this to work, the relationship between the parent and child objects must be a lookup field, and the child object must be private on OWD. You may also have to implement some custom sharing rules via Apex if your rules are sufficiently complex.

 

This is a fairly complex approach but it may work. The real question in my mind is - why? What's the use case you are trying to fulfill?

 

Hope this helps,