Add custom button on form toolbar

How to add an option of “stop” option in newly created document.

frm.on("[doctype]", {
  refresh: function(frm) {
    frm.add_custom_button(__('Open'), function() { 
        // click
      }, __('Show'));
  }
}

2 Likes

Thanks Rushabh.
I have created a custom script for the doctype and pasted above code. But document displays nothing.
Could u please tell me what wrong I did?

I have replaced “doctype” with name of the doctype.
I have tried without replace also.

Trying the same,

frm.on("ABC", {
  refresh: function(frm) {
    frm.add_custom_button(__('Click here'), function() { 
        // click
      }, __('New'));
  }
}

What i want to do is disable the “New” button on form page and make a new button with name “click here” and set the exact same task done by new to that button.

Any help ??

Try frm.page.set_primary_action


frappe.ui.form.on('Opening Invoice Creation Tool', {
	....
	refresh: function(frm) {
		frm.disable_save();
		frm.trigger("make_dashboard");
		frm.page.set_primary_action(__("Make Invoices"), () => {
			let btn_primary = frm.page.btn_primary.get(0);