Child Table Rows are Automatically Removed

Hello,

We have a Child Doctype created which is referenced in two Doctypes A and B.

We have a workflow where an organization details are initially added to a Doctype A where the records are also inserted for the Child doctype.

There is a logic written on the OnChange of this doctype A where for a particular workflow state some of the details are inserted into another Doctype B. The records for the child table are also inserted into Doctype B.

We are facing an issue where if an user is editing a few details and saving in Doctype B the system is automatically removing the Child table records.

This removal is even tracked in the changes, but the user had made no modifications in the child table records, they were automatically removed by the system.

Has anyone faced such kind of issue before, any inputs on debugging this issue would be very helpful.

Thanks and Regards,
Akash