Adding Custom Button to ListView of Module

I have created a custom module and want to add a Button that calls a backend function. So far I have only found guides on how to add buttons to detailviewdefs like this one but none of them show on how to add a button in the Listview in v8.

I circled the position in the screenshot where I want the button (it should generate PDFs). Is this even called Listview?
Any help or further links would be appreciated :smiley:

Yes, I think that’s a List view.

I don’t know the answer, but…
Can you find any example in core modules where such an extra button exists?

I am reworking an old module where such a button exists so there is definitely a way havent looked that deep into the core modules, but I am also not able to find where the New Buttons is defined (I could just change that one).

On Contacts module, I see a button on the list view saying "Import Contact from vCard".

Searching the code for that string, I see it’s label LNK_IMPORT_VCARD.

Searching the code for that, I see it’s used in public/legacy/modules/Contacts/Menu.php, and the option is created my adding an entry to a $module_menu array.

That seems to be loaded in public/legacy/include/MVC/View/SugarView.php, function getMenu.

I’m pretty sure that changing this will solve your problem in legacy modules, I am not so sure if that same scheme is used in v8 modules, but I think it is. Didn’t try it, though.

Tell me how it goes :slight_smile:

There’s actually documentation for this!

1 Like

Thx for sharing as I noticed they are also using the LegacyHandler Function to access Beans. So now there is documentation on that yay

1 Like

Hi sorry i know this is a slightly old thread now but wondering if someone could help me with this? I have managed to get the button into the menu dropdown as per the documentation but i still cannot figure out how to get the button as per the original post screenshot?

I can find all sorts of screenshots and videos with seaid buttons in but I cannot for the life of me figure out how to do it

any help would be much appreciated

I think that screenshot was from v7, just saying “this is where I would want it”.

There’s an option in Admin / System settings to show all the buttons on the top, instead of inside a dropdown. I always set that for everyone in the organization, saves a ton of clicks. Maybe that will make your button visible enough.

that is a v8 screenshot the NEW button should be there by default it is used to create a new record. If you followed the guide linked in this thread the button should work and call your processhandler

I’m using the latest version and have followed the guide but there is no button, it only appears in the module menu drop-down

I’ve attached a screenshot from my phone as I’m not by my pc but the result is the same