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
Jagadeesh AdaveniJagadeesh Adaveni 

I have account object.. I want to show all its child objects in another adjusent column

Hi all,

I have Parent objects.. I want to show all its child objects in another adjusent column based on parent selection. For this i have used Dynamic Schema.
With Dynamic schema i am able to get all parent objects into picklist but unable to get childs.

Please help me out.

Thanks,
A.Jagadeesh
Andy BoettcherAndy Boettcher
Can you post your code for the community to help you with?  It's far easier to help you when we see what you're trying to do.  Please remember to use the code formatter "< >" button in the composer here.
Jagadeesh AdaveniJagadeesh Adaveni
apex:page controller="ObjectRetrieve">
   <apex:form >
   <apex:pageBlock >
    <apex:outputlabel value="All Objects"/>&nbsp;&nbsp;
     <apex:pageBlockTable value="{!objnames}" var="a">
       <apex:column value="{!a}"/>
     
     </apex:pageBlockTable>
     </apex:pageBlock>
   </apex:form>
</apex:page>



public with sharing class ObjectRetrieve {


public List<String> getobjNames()
{
List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();
List<String> options = new List<String>();

for(Schema.SObjectType f : gd)
{
if(f.getDescribe().getName().contains('__c'))
options.add(f.getDescribe().getName());
}
return options;
}
}
Jagadeesh AdaveniJagadeesh Adaveni
public with sharing class ObjectRetrieve {

//Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();
List<String> options = new List<String>();
public List<String> getobjNames()
{
 
Schema.DescribeSObjectResult describeresult = Account.SObjectType.getDescribe();
List<Schema.ChildRelationship>   lstchildrelationships =describeresult.getChildRelationships();
for(Schema.ChildRelationship relname:lstchildrelationships){
      System.debug('Relationshipname:'+relname.getrelationshipname());
      options.add(relname.getrelationshipname());
}
return options;
}
}
Jagadeesh AdaveniJagadeesh Adaveni
Above code refers to get all account object children but i need children based on parent
Andy BoettcherAndy Boettcher
Check this post out - this implementation is tricky if you try to load all objects at once as you'll hit Describe limits.  If you implement some lazy loading here - you should be able to make this work:

https://jungleeforce.wordpress.com/2013/06/07/extracting-list-of-all-the-objects-standard-custom-in-salesforce/