Custom button in detailview SugarCRM / SuiteCRM

It will be done by below steps only! Lets do this,

STEP 1 : Add smarty variable in custom/modules/<desired_module>/metadata/detailveiwdefs.php as following,

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

Step 2 : We can assign the values to smarty variable in custom/modules/<desired_module>/views/view.detail.php and can use the smarty variable

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

Step 3 : Quick Repair, then hard refresh your browser. All Done !

Step 4 : Done! Refresh the page and start testing.

Note :

1. Read the comments in code carefully and replace the variables as asked.
2. Here, <desired_module> means the module name you see in the URL, for example, Contacts, Leads, Accounts, etc.
3. You may find the field names and its labels in Admin > Studio > <Your_module> > Fields > <Choose correct field> > Take 
Field Name and System Label.

Hope you find this blog post helpful.

Feel free to add comments and queries, that helps us to improve the quality of posts.

You can contact us at

Thank you.

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *