How to Customize "Create" Button Functionality?

Hello everyone,

There is a functionality in ERPNext where there is a “Create” button in the (Material Request) that creates (Request for Quotation) OR (Supplier Quotation) OR (Purchase Order), and also make it to inherit/copy the values from it.
Please kindly help me, I want to make the same functionality for a Custom doctype (Bill of Quantity) so that when a user raise a BOQ and then submit the BOQ, it will create a Material Request and also inherit/copy the values from it.

https://frappeframework.com/docs/v13/user/en/api/form#frmadd_custom_button

@dj12djdjs

I am not a developer, Please kindly send me the function.

Hi @wolealadekoba,

Please check it.

frappe.ui.form.on('Your DocType', {
	refresh(frm) {
		frm.add_custom_button(__("Button Name"), function() {
				/* When this button is clicked, do this */
			}, __("Create"));
	}
});

Thanks.

@NCP , it did not work.

@NCP , the code did not work.

https://docs.erpnext.com/docs/v12/user/manual/en/customize-erpnext/custom-scripts/custom-button