I am currently working on customizing the list view of a specific doctype and would like to inquire about adding a button. My intention is to include this button exclusively for this particular doctype, without affecting any others.
Could you please provide guidance on how to achieve this customization?
I am unable to create button in the listview please explain me clearly
NCP
June 15, 2024, 7:30am
4
See all the references given to you and apply the Listview client script.
i am also apply same action but i am not getting the result
My Script:
My Doctype:
NCP
June 15, 2024, 8:02am
6
Check first example in reference:
Hi @Hiro ,
Please apply it.
frappe.listview_settings["Prospect"] = {
onload: function(listview) {
listview.page.add_action_item(__("Actions"), () => {
frappe.msgprint("Action Clicked");
});
}
};
Output:
[image]
In v15/14, the syntax is changed.
Hi @NCP is there a way we can disable these actions based on role?
NCP
September 27, 2024, 12:11pm
9
possible using frappe.user.has_role
frappe.listview_settings[‘Doctype’] = {
onload: function(listview) {
if (frappe.user.has_role(‘Role’)) {
listview.page.clear_actions();
} else {
listview.page.add_action_item(__(“Actions”), () => {
frappe.msgprint(“Action Clicked”);
});
}
}
};
i tried this code but its hiding for all roles.
can you help me out?
NCP
September 27, 2024, 12:14pm
11
Thanks! Appreciate the response!