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
I.S.KI.S.K 

how to prevent the parent record from the deletion

Hi,

Kindly please let me know how to prevent the parent record from the deletion when the child record referencing the parent.

 

This could be done with the lookup relationships.

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
Starz26Starz26

You will have to write a before delete trigger, query for children and if they exist, add an error to the parent record.

All Answers

Starz26Starz26

You will have to write a before delete trigger, query for children and if they exist, add an error to the parent record.

This was selected as the best answer
I.S.KI.S.K

Hi.

 Thanks for your help... i have used a trigger on the parent object and queried the children and put the error if they exist.