使用views.detail.php在detailview中自定义按钮SugarCRM


Custom button in detailview using views.detail.php SugarCRM

我在模块的详细视图中创建了一个自定义按钮"下载列表",我还在模块的目录中创建了操作"downloadList"。点击下载列表,我称之为类似的动作

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">')

我的所有代码都运行良好。

但问题是,我必须使用views.detail.php来实现相同的功能。为此,我制作了一个自定义的views.detail.php文件,并在其中编写了所有代码。

现在我不知道如何在点击按钮时调用该函数。有人能帮忙吗。。。

我们可以像下面的views.detail.php中那样将值分配给smarty变量,并可以在detailveidefs中使用smarty可变变量,如下所示:

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

通过在detailviewdefs.php 中使用以下代码

    'buttons' => 
    array (
      5 => 
      array (
        'customCode' => '{$mail_to_members}',
      ),
     ),