How can we hide the button groups ‘Action’ , ‘Create’ fully or the items in the dropdown. Solutions for both appreciated.
thanks in advance
How can we hide the button groups ‘Action’ , ‘Create’ fully or the items in the dropdown. Solutions for both appreciated.
thanks in advance
Hi @Ashique
The Client Script can override controls for a doctype for its List as well Form.
I just asked Chapgpt to help me with your question and it has suggested me following JS lines which you can also paste in client script as it has worked for me.
frappe.ui.form.on(‘Lead’, {
refresh: function(frm) {
// Hide specific items in the “Create” menu
frm.page.hide_menu_item(‘Create Opportunity’);
frm.page.hide_menu_item(‘Create Quotation’);
frm.page.hide_menu_item(‘Create Customer’);
frm.page.hide_menu_item(‘Create Project’);
// Optional: hide the entire menu if nothing else is needed
setTimeout(() => {
const dropdown = frm.page.wrapper.querySelector('.dropdown-toggle');
if (dropdown && dropdown.innerText.includes('Create')) {
dropdown.closest('.btn-group').style.display = 'none';
}
}, 100);
}
});
Hi @Ashique
Please read this Documentation
Try this script.
frappe.ui.form.on('Lead', {
refresh: function(frm) {
alert("Test")
setTimeout(() => {
frm.remove_custom_button('Customer', 'Create')
frm.remove_custom_button('Opportunity', 'Create')
frm.remove_custom_button('Quotation', 'Create')
frm.remove_custom_button('Prospect', 'Create')
frm.remove_custom_button('Create');
}, 10);
}
})
Thank You!
when i tried the first code snippet buttons which is not mentioned in the code also has been hidden.
the second snippet is not working for me.
i am using frappe 14. might be due to that.
thank you for your response
This solution is working for me .
Thank you for your response.