function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Prabodh SPrabodh S 

if the field is having look-up relationship or master detail---- through API

hi,

I am trying to identify the difference between look-up relationship and master-detail relationship.

When I call describe on any custom object then how can i identidy the which field is having look-up relationship a
nd which one is having master-detail relationship.

In short from API I need to identify if the field is having look-up relationship or master-detail relationship.
If there is any property field or any clue in schema, that can help to identify it.

Please help me out........

Thank you in advance.

Regards,
Prabodh
RickyGRickyG
Prabodh -

The ChildRelationship object which is returned as part of the DescribeSObjectsResult has a boolean called cascadeDelete.  Master-detail relationships enforce a cascade delete while lookup relationships do not - my limited testing of this shows that master-detail return the cascadeDelete field as True.

Hope this helps.

Prabodh SPrabodh S

Thank you Rick,

Apart from cascadeDelete, master-details is mandatory i.e if the field is having master-detail, it can not be empty while updating object data.

Could you give your views on this.

Regards

Prabodh