0

I have 2 doctypes, When i press button i want to send fields data, and items to another doctype, during research i found sample like this. But doesn't working at all. Any suggestion?

frappe.ui.form.on('Testdatafrom', {
    custom_button: function (frm, cdt, cdn) {
        msgprint(frm.doc.custom_label);
        frappe.set_route("Form", "Testdatato", "New Testdatato 1", { "name": frm.doc.custom_label});
    }
});

enter image description here

And show custom_label in here like this

frappe.ui.form.on('Testdatato', {
    onload(frm) {
        frm.set_value('custom_label', name);
    }
});

enter image description here

Elliot
  • 598
  • 6
  • 25

1 Answers1

0

Try this:

frappe.ui.form.on('Testdatato', {
    onload(frm) {
        let name = frappe.route_options.name;
        frm.set_value('custom_label', name);
    }
});

The object passed along with the route are saved under frappe.route_options

gavin
  • 793
  • 1
  • 7
  • 19