How can I add Custom Menu Entries in the Main Sidebar?

I’d like to insert custom menu entries in the sidebar as shown in the screenshot below.
Also, I want to be able to do this conditionally based on information about the currently logged in user.

What is the best way to do this?

1 Like

Hi, to add new menu entries you have to create a new “Workspace”. “Build” → “Workspace”. It’s necessary that the module where you save the workspace has at least one doctype to appear in the menu.
You can limit menu entries based in allowed modules. In “User Form” → “Allow Modules”.

There has got to be a more flexible way to deal with this.

Right now, I am only given the option of creating Modules which link to workspaces with doctypes and shortcuts.

How could I use the built-in client javascript to add my own elements to the Modules menu and attach event listeners to those elements so I can run my own javascript when the links are clicked.

1 Like

I’ve the same problem. I override “frappe/frappe/public/js/frappe/views/workspace/workspace.js” to add custom entries to the side menu.

I don’t have a v13 instance available to test, but it should be possible to extend the Workspace class and then override the reference that frappe keeps to it here.

In your app js, it’d be something like:

frappe.views.Workspace = class CustomWorkspace extends Workspace {
   //your custom code
}

It may be worth mentioning too that v14 includes a significant rewrite of how desk pages work, though I don’t believe it’s possible there either to add arbitrary links or js triggers on the sidebar.

2 Likes