[Solved] Change the color of a custom button on a form

There are some helpful posts here and here.

The code below shows how to also remove the default class (which stopped the addClass from applying) and also including a function.

frappe.ui.form.on('Salary Structure Assignment', {
	refresh(frm) {
    	frm.add_custom_button("Salary Structures...", function(){
            frappe.set_route("Form", "salary-structure", "")
        })
        .addClass("btn-warning").css({'color':'black','font-weight': 'bold'})
        .removeClass("btn-default");
	}
})
3 Likes