You need to sign in to do that
Don't have an account?
aaryansri
how to delet parent record having child records using DML
I have 2 sobjects faculty and student. In that faculty is parent and student is child and relation ship is master relation ship. I want to delete parent records with out deleting linked child records using DML operations.
Ideally speaking, whenever you delete your master(parent) record all related detail(child)records will be deleted as its a master detail relationship.
If you want to retain child record then you have to clear out the relationship with master object given that field is not mandatory.
i.e. update all student records for related faculty with null/empty value and then delete the faculty.
Though it is possible it is not recommended as it will create garbage data in your org.
If this answered your question, mark this as best answer.
-N.J
One more alternative. You can ensure that the child object has "allow reparenting" enabled, change the parent of the child record to some other dummy parent record, and then delete the original parent record.
If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.
Thanks,
Shashank