New answers tagged

0

Try this Code to fetch the child objects which have the opportunity as parent object String parentObjectName = 'Opportunity'; Map<string,string> objectRelationshipMap = new Map<string,string>(); Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); for(String ss1: schemaMap.keyset()){ Schema.SObjectType objToken=...


0

Try this: Opportunity.getSObjectType().getDescribe().getChildRelationships(); Edit: Ouh, @TSmith answered before me ;D Gj!


1

You can use the DescribeSObjectResult class to access any SObject parent and/or child objects. Here is a print out of child objects of the Opportunity SObjectType. Schema.DescribeSObjectResult sobResult = Opportunity.SObjectType.getDescribe(); for (Schema.ChildRelationship childRel : sobResult.getChildRelationships()) { System.debug('Child Object: ' + ...


3

I tried to retest the performance of the 3 approaches (added getSObjects(SObjectField) approach). Org Params: ApiVersion: 51.0 InstanceName: CS100 IsSandbox: true OrganizationType: Developer Edition Results for 50 trials each of 20.000 calls: Approach MIN CPU (ms) MAX CPU (ms) AVG CPU (ms) STD (σ) acc.Contacts 10.00 16.00 12.63 1.83 acc.getSObjects('...


Top 50 recent answers are included