Mansoor Jafar
Mansoor Jafar

Reputation: 1488

Custom button in detailview using views.detail.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...

Upvotes: 3

Views: 6096

Answers (1)

Mansoor Jafar
Mansoor Jafar

Reputation: 1488

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}',
      ),
     ),

Upvotes: 4

Related Questions