2

I have custom object which has the address fields, so if one enters the suburb then it should lookup another objects and list out probable postcode and states which would allow the user to choose the correct one.

For this reason i wanted to use a VF page as i would not be able to do this in the standard layout. This brings out a problem of changing the VF page each time a new field is added/removed. This could also be resolved by fieldsets i guess.

We would also need to have the ability to add / remove relatedlists as well dynamically instead of changing the VF page everytime we want to add / remove a related list. Is there a way to query for relatedlists from a pagelayout or something like that

1

I would try to use Schema.DescribeSObjectResult class to get all child relationship name of the object. You can then use these names for the apex:relatedList tag:

Schema.DescribeSObjectResult R = CustomObject__c.SObjectType.getDescribe();

for(Schema.ChildRelationship rs :R.getChildRelationships()){
    System.debug('#### rs: ' + rs.getRelationshipName());
}
  • This would provide me all child relationships, i am assuming that we cant query from particular pagelayout. or i can have the custom setting where i can set the which all related lists need to be there in the VF page – Prady Sep 3 '14 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.