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