Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom button in detailview using views.detail.php SugarCRM

Tags:

php

sugarcrm

I have made a custom button 'download list' in detailview of my module , I also made an action 'downloadList' in my module's directory. OnClick of download list i called the action like

array('customCode' => '<input class="button" onclick="window.open(\'index.php?module=av_module&action=downloadList&record={$fields.id.value}&&sugar_body_only=true\');" value="Download List">')

all my code is doing well .

But the issue is i have to use views.detail.php to achieve same functionality . for that i made a custom views.detail.php file and wrote all my code in it .

Now i don't know how to call that function on button click. Can anyone help please...

like image 547
Mansoor Jafar Avatar asked Apr 19 '26 08:04

Mansoor Jafar


1 Answers

We can assign the values to smarty variable like in following views.detail.php and can use the smarty variable in the detailveiwdefs as follwing:

$this->dv->ss->assign('mail_to_members', '<input type="button" 
onclick="javascript: location.href=\'mailto:?bcc='.$mem_email.'\'" value="Mail to Members"/>');

By using following code in detailviewdefs.php

    'buttons' => 
    array (
      5 => 
      array (
        'customCode' => '{$mail_to_members}',
      ),
     ),
like image 161
Mansoor Jafar Avatar answered Apr 21 '26 20:04

Mansoor Jafar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!