👩‍💻 Check out our latest job positions here 👈 or send us a PM for more info.

Create new Bulk Action Button

Hi to all,
does anyone have ever tried to create a new bulk actions button from scratch in List View?
I have too much actions in a module and appending them to current one is too confusing.

Tried to see the code on browser debugging tools but not so clear how it works the current one.
Any help will be appreciate.

Attached screenshot regarding what i would like to achieve.
Many thanksmy_new_bulk_action


The buttons:

  • present into files themes/SuiteP/include/ListView/ListViewPaginationTop.tpl and themes/SuiteP/include/ListView/ListViewPaginationBottom.tpl
  • include from themes/SuiteP/include/ListView/ListViewGeneric.tpl
  • created in include/ListView/ListViewSmarty.php

Look at line of file themes/SuiteP/include/ListView/ListViewPaginationTop.tpl :

{sugar_action_menu id=$link_action_id params=$actionsLink}

You should do custom files:

  • themes/SuiteP/include/ListView/ListViewGeneric.tpl
  • themes/SuiteP/include/ListView/ListViewPaginationTop.tpl
  • themes/SuiteP/include/ListView/ListViewPaginationBottom.tpl
  • include/MVC/View/views/view.list.php with custom function which will create the buttons.

The files ListViewGeneric.tpl and view.list.php SuiteCRM will find automatically and ListViewPaginationTop.tpl and ListViewPaginationBottom.tpl should be write directly.

Thanks for the hint…
I will do some tests and I’ll let you know.

@rainolf Can you please share your solution if you have managed to do this?

Sure…I will check what i have dove so far and i will be back to you…

Ok here i am.
I’ve developed a custom action button in the Detail View.

Under custom/modules/module_name/views/view.detail.php

In the preDisplay function i’ve added something like that:

function preDisplay(){
global $app_strings;
$js = <<<JS
<script type="text/javascript">
		$(".nav-tabs #tab-actions").before(htmlContent = `
			.content #tab-actions > .dropdown-menu .button:hover{
	    			color: darkcyan;
		<li id="tab-actions" class="dropdown">
	    	<a style="background-color: #aa9dcc;border: 1px solid #aa9dcc;" class="dropdown-toggle" data-toggle="dropdown" href="#">{$app_strings['LBL_CDZ_MODAL_CONTRACT_NAV_DETAIL_BUTTON_ACTION']}<span class="suitepicon suitepicon-action-caret"></span></a>
		<ul style="background-color: #aa9dcc" class="dropdown-menu">
			<li style="background-color: #aa9dcc" ><input style="background-color: #aa9dcc" title="Activate" accesskey="{$app_strings['LBL_CDZ_MODAL_APPROVE_BUTTON_ACTION']}" class="button" onClick="javascript:contractAction(\'{$_REQUEST['record']}\',\'approve\', \'{$_REQUEST['module']}\', \'none\', \'detail_view\');" id="approve" name="approve" value="{$app_strings['LBL_CDZ_MODAL_APPROVE_BUTTON_ACTION']}" type="button"></li>
echo $js;

So i’ve inject some html code into Detail View.

Attached you will find the result screenshot.

Hope it can help.

Thanks @rainolf , but it’s not what I want. You show detail view example. But the question is about List View bulk action, which is more complicated. I dig it out little by little. But custom JS override to show/hide the new button is needed as well as custom CSS.

I agree with you.
In the past i tried building a nested menu instead a new one in ListView and I remember it was really complex situation.

If I make a copy of it I will post it.
I must check.