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
Anil Rao 17Anil Rao 17 

why is opportunity & Opportunity Product a Lookup versus Master-Detail?

Isnt a M-D relationship the correct relationship between opportunity & Opportunity Product ? When a Opportuntiy is deleted, I want the OP records to be deleted. Hnece doesnt a MD rleationship makes sense?
Best Answer chosen by Anil Rao 17
Natarajan _Periyasamy__cNatarajan _Periyasamy__c
That's a good question. Though the relationship between the Opportunity and Opportunity Product is Lookup (As per the standard field definition), it's still a kind of special relationship and it behaves exactly like a MD relationship.

a. You can create Rollup summaries
b. You won't be able to insert Opportuniuty Line Item without Opportunity
c. When you delete the Opportunity, it will delete the related Opportunity Products as well.
d. When you share the Opportunity, Opportunity Product will be shared automatically

You will see the same between Account => Contact, Account => Cases, Account => Opportunities and Opportunity => Opportunity Products i.e., Though the relationship is lookup (technilcally as per the field definition) it still works like MD in some use case scenarios.

Regards,
Natarajan

All Answers

Natarajan _Periyasamy__cNatarajan _Periyasamy__c
That's a good question. Though the relationship between the Opportunity and Opportunity Product is Lookup (As per the standard field definition), it's still a kind of special relationship and it behaves exactly like a MD relationship.

a. You can create Rollup summaries
b. You won't be able to insert Opportuniuty Line Item without Opportunity
c. When you delete the Opportunity, it will delete the related Opportunity Products as well.
d. When you share the Opportunity, Opportunity Product will be shared automatically

You will see the same between Account => Contact, Account => Cases, Account => Opportunities and Opportunity => Opportunity Products i.e., Though the relationship is lookup (technilcally as per the field definition) it still works like MD in some use case scenarios.

Regards,
Natarajan
This was selected as the best answer
Anil Rao 17Anil Rao 17
Thanks.
But still why define it as a lookup & (probably) via code in the background make it work like MD versus just making it as MD.
Natarajan _Periyasamy__cNatarajan _Periyasamy__c
It's prebuilt from Salesforce and you won't be able to change the standard schema. Hope that helps!