Custom Script issue in V11

Hello Everyone,

I am facing issue with my custom script after upgrading to Version 11.

I was using the script to fetch data from the Sales Order item table to Custom Doctype Item table.
In both the documents, the sales order item table is linked.

The idea was to populate the items from Sales Order to a custom Job Card document.

Below is the script which I was using.

//Including sales order items on the internal job card.
frappe.ui.form.on("Internal Job Card", "sales_order", function(frm) {
    frappe.model.with_doc("Sales Order", frm.doc.sales_order, function() {
       var tabletransfer= frappe.model.get_doc("Sales Order", frm.doc.sales_order)
        $.each(tabletransfer.items, function(index, row){
            d = frm.add_child("items");
            d.item_code = row.item_code;
            d.item_name = row.item_name;
            d.uom = row.uom;
            d.description = row.description;
            d.qty = row.qty;



can you share a screenshot of error message!

Dear Omar,

Thank you for your response.
Unfortunately, there are no logs available on the system.

I have the below screenshots, the same script works on V10.
Image of V10 & V11 Versions


do you have any solution to this problem? this is holding us back from upgrading to v11, thanks