Search code examples
sugarcrmvtigervtigercrm

How to show related email on popup composeMailData - Vtiger


I have a custom module, in this module there is a field related to the account, then I create an email send button on the detail page, how can when the compose mail popup is displayed, the email of this account is added automatically.

EditView enter image description here

DetailView (compose mail popup) enter image description here


Solution

  • You need to put that logic in your view controller. Take vtigercrm/modules/Vtiger/views/ComposeEmail.php as an example and create vtigercrm/modules/YourCustomModule/views/ComposeEmail.php

    You need to do something similar to this when processing the request:

    $accountId = $request->get('accountid');
    $account = Vtiger_Record_Model::getInstanceById($accountId);
    $viewer = $this->getViewer($request);
    $viewer->assign('TO', $account->get('email'));