You need to sign in to do that
Don't have an account?
Master-detail relationship between Product2 and a junction object
Hi friends,
Is there any way to create a master-detail relationship between Product2 and Junction Object.
Is there any way to create a master-detail relationship between Product2 and Junction Object.
Unfortunately No, it's a seemingly arbitrary limitation of the platform and the Product2 object.
Alternate Approach to achieve this is to create your lookup as a standard non-required Lookup and then enforce that the value of this lookup cannot be blank using a validation rule.
Your validation rule will look something like this:ISBLANK(ProductId__c), If the Product is deleted then this will result in the value of the field being cleared, as per the default 'Clear the value of this field.' behaviour, which will prevent you updating the child record until a valid lookup ID is entered.
If you want to change this behaviour you'll have to write a before delete trigger on Product2 with your desired logic.
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Thank you
BLearn - Sai