Custom button remove

Hello,

I want to remove this workspace button on the basis of the role. Please guide me.

Screenshot from 2022-10-15 18-23-30

Thanks in Advance

1 Like

@Foram I think that you can achieve what you want by changing the permissions of the roles you want to hide the button from.

Go to Role Permission Manager, select Workspace doctype and select the role you want to change the permissions for the uncheck the create box…

But I had not given any permission related to the workspace to that role in the Role Permission Manager. But then also that button is not removed…

@Foram How about you try removing them using JS…

frappe.workspace.page.clear_primary_action();
frappe.workspace.page.clear_secondary_action();
frappe.workspace.page.clear_inner_toolbar();

Ok, so where to write this script? Like in the client-side scripting have to select the doctype, in that which to select, and how to define that?

@Foram I don’t think that it will work as a Client Script. Can you please tell me where this button exists? In what doctype? Or it is a workspace of a doctype?

The button is on the home page and everywhere.

@Foram Sorry buddy I couldn’t find any solution other that a custom plugin that contains a JavaScript file which modify the functionality of Workspace page…

I thought that removing the Workspace create permission from roles will hide the button but in the code it doesn’t check for any permission other than if the user is allowed to display the page or not…

Ohh if you find it then please suggest me too.

Hey Foram,
Have you got solution about it

No, I did not got any solution for it.

I got the solution for it now

please mention

Please mention

Can you explain?