Quick entry from custom button

Hello there,

I want to add a custom button. It works with this code.

		frm.add_custom_button(__('MyDoctype'), function() {
			make_my_new_doc(frm, "SomeValue");
		}, __("Make"));

However, my MyDocType supports Quick Entry for required fields. Unfortunately, It doesn’t open the Quick Entry Dialog with my code above.

Any ideas?

use frappe.new_doc()

Quick Entry for doctype is only enabled if you have 8 or less than 8 mandatory fields.

1 Like

Great! Thank you very much!

This works:

frappe.new_doc("MyDocType")

and if I want to prefill fields I do:

frappe.new_doc("MyDocType", {"customer": "TheCustomersName"});
3 Likes

@makarand_b Is there a way to show fields in quick entry, which are not mandatory?

make the field as bold

1 Like

Works! Thank you very much again!