You need to sign in to do that
Don't have an account?

Mother - Child relationship
I want to add a new mother object record and add a new child record. I cannot insert the mother record until the end of the batch. There will be multiple mother records. How can I give the child record the mother's ID before the mother is saved? Can I add the mother and child in the same DML add function? It doesn't work for me currently.
Some code would help to understand your problem. In this case, if you are inserting the parent record in a loop you might have the too many DML governor issue. Try doing it in bulk.