You need to sign in to do that
Don't have an account?
mworld
Locating Master/Detail and Lookup Relationships for a given Object
What are my options, if any, to programmatically determine what Master/Detail or Lookup relationships a particular Object is involved in?
We would like to prevent users from deleleting an Account (for example) that is involved in the above relationships. We would prefer not to hard code the existing relationships but rather determine them dynamically so that we don't need to continually update the code as we add objects to our system.
Ideas?
The following will give you a list of all the child relationships:
You can then used the methods described here to do whatever you need.
Here is an example for two custom objects
FSA is child of IHO. No delete IHO if fsa exists