You need to sign in to do that
Don't have an account?
sravanthi bhavanam
API to determine Master-Detail or Lookup relationship
How do we find if a given field is part of a Master-detail or a lookup relationship? Using SOAP API, the describesObjectResult
has childobjects that does not have the relationship type.
has childobjects that does not have the relationship type.
For Master-Detail relationships you will get 0 or 1 and for lookup relationships you will get NULL
Per the documentation (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_describesobjects_describesobjectresult.htm), it says that the getRelationshipOrder() can never be null. I have also checked while retrieving a lookup field which is not null.
"The type of relationship for a master-detail relationship field. Valid values are:
0 if the field is the primary relationship
1 if the field is the secondary relationship"
I am using SOAP API and the value is never null. It is always either 0 or 1. This poses issues in actually using this field.