Created
May 18, 2020 19:50
-
-
Save shanerk/38648262665500d4e7a479188e843110 to your computer and use it in GitHub Desktop.
Gets list child relation API names based on the child object type (Salesforce Apex)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gets list child relation API names based on the child object type (Salesforce Apex) | |
// | |
DescribeSObjectResult type = SobjectType.Account; | |
String filter = 'Feed'; | |
for (ChildRelationship relation : type.getChildRelationships()) { | |
if (String.valueOf(relation).contains(filter)) | |
system.debug('* ' + relation.getChildSObject() + ' = ' + relation.getRelationshipName()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment