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
Sree SalesforceSree Salesforce 

I have lookup relationship between 2 objects.if i delete the parent record i want to delete the child record also .how can i do this

James LoghryJames Loghry
First of all, read through this document and you should have a better understanding: https://help.salesforce.com/HTViewHelpDoc?id=relationships_considerations.htm&language=en_US (https://help.salesforce.com/HTViewHelpDoc?id=relationships_considerations.htm&language=en_US)

In a nutshell, Children are deleted automatically in Master Detail relationships, but not Lookup relationships.

If you need to delete children when a parent is deleted, then you will need to write a on delete Apex trigger on the parent object to handle that situation.
Deepak Kumar ShyoranDeepak Kumar Shyoran
For that you nedd to use master-detail relationship otherwise need write a trigger ondelete envet on Parent Obj to delete child Obj records.
Deepak Kumar ShyoranDeepak Kumar Shyoran
For that you nedd to use master-detail relationship otherwise need write a trigger ondelete envet on Parent Obj to delete child Obj records.
Yunus KalamYunus Kalam
I have also same scenerio and i want this by trigger can anyone help me about this trigger ?
Suggestion would be highly appericiated 
Thanks 
 
Duggi BannaDuggi Banna
No you can also do this In Lookup Relationship though its not best case scenrio.

go into your lookup relationship object edit your lookup details and in lookup Options you can set this.

Hope it works for you !!