Child Table of One doc type copy to child table of another doctype

frappe.ui.form.on("DocTypeB", "Trigger", function(frm) {
    frappe.model.with_doc("DocTypeA", frm.doc.trigger, function() {
        var tabletransfer= frappe.model.get_doc("DocTypeA", frm.doc.Trigger)
        $.each(tabletransfer.ChildTableA, function(index, row){
            d = frm.add_child("ChildTableB");
            d.field1 = row.fielda;
            d.field2 = row.fieldb;
            cur_frm.refresh_field("ChildTableB");
        });
    })
});

when i run this code it say DocTypeA not found

Please help.

Two suggestions -

Post the ‘stack trace’ traceback with this error:

"
when i run this code it say DocTypeA not found
"

And this Search results for 'tabletransfer' - ERPNext Forum holds lots of clues to troubleshoot.

Please share what you learn thanks…