You need to sign in to do that
Don't have an account?
Shank_dhel
want to get child object for an object which has only master detail relationship
hi ,
i'm getting objects from schema
based on the user selection of object ,it has to display all the child objects of the selected master object which has master detail relationship .
i'm using getChildRelationships() function to get the child relationship
but how to restrict it to get only childs with master detail relaationship
thanks in advance
There's a workaround for this but bit kludgy
Schema.DescribeSObjectResult R = Account.SObjectType.getDescribe(); // Get the info regarding object
List<Schema.ChildRelationship> C = R.getChildRelationships(); // Get all the child relationships
Now that you got the child relationships, you can iterate the list and check for "isCascadeDelete()" method
which returns the boolean value. Since value for MD will be true, you can consider
those relationships as master detail
All Answers
There's a workaround for this but bit kludgy
Schema.DescribeSObjectResult R = Account.SObjectType.getDescribe(); // Get the info regarding object
List<Schema.ChildRelationship> C = R.getChildRelationships(); // Get all the child relationships
Now that you got the child relationships, you can iterate the list and check for "isCascadeDelete()" method
which returns the boolean value. Since value for MD will be true, you can consider
those relationships as master detail
Thanks a lot Gunners
u saved my day ...
coffee is on me... :)