Khatavahi BI Solutions LLP - Add Custom Button on Form

Add custom button on form when perticular condition is true in frappe and erpnext

 · 1 min read

// Script for ToDo Form
frappe.ui.form.on('ToDo', {
   // on refresh event
   refresh(frm) {
       // if reference_type and reference_name are set,
       // add a custom button to go to the reference form
       if (frm.doc.reference_type && frm.doc.reference_name) {
           frm.add_custom_button(__(frm.doc.reference_name), () => {
               frappe.set_route("Form", frm.doc.reference_type, frm.doc.reference_name);
           });
       }
   }
})

Connect

We believe in the transformative potential of ERPNext.


Jigar Tarpara

ERPNext & Frappe Consultant ERPNext & Frappe Developer CEO at Khatavahi BI Solutions LLP

No comments yet.

Add a comment
Ctrl+Enter to add comment