AnsweredAssumed Answered

In Sugar 7.6 I want the to customize the email template for call.

Question asked by Debanshu Kar on Oct 25, 2017

DeveloperAlex Nassi

 

SugarCRM Call - {CALL_SUBJECT}
To: {CALL_TO}
 {ASSIGNER} has invited you to a Call
Subject: {CALL_SUBJECT}
Status: {CALL_STATUS}
Start Date: {CALL_STARTDATE}
Duration: {CALL_HOURS}h, {CALL_MINUTES}m
Description: {CALL_DESCRIPTION}

 

Accept this call:
<{ACCEPT_URL}&accept_status=accept>

Tentatively Accept this call
<{ACCEPT_URL}&accept_status=tentative>

Decline this call
<{ACCEPT_URL}&accept_status=decline>

 

This is the email template the sugar uses path : include/language/en_us.notify_template.html

 

I want to add few for information in this email template for e.g. Account Name, but unfortunately not working any help is appreciated.

 

Steps I am following :

 

Step 1 : Copied the language file to path : custom/include/language/en_us.notify_template.html

SugarCRM Call - {CALL_SUBJECT}
To: {CALL_TO}
 {ASSIGNER} has invited you to a Call
Subject: {CALL_SUBJECT}
Status: {CALL_STATUS}

Account Name: {ACC_NAME}
Start Date: {CALL_STARTDATE}
Duration: {CALL_HOURS}h, {CALL_MINUTES}m
Description: {CALL_DESCRIPTION}

 

Accept this call:
<{ACCEPT_URL}&accept_status=accept>

Tentatively Accept this call
<{ACCEPT_URL}&accept_status=tentative>

Decline this call
<{ACCEPT_URL}&accept_status=decline>

 

Step 2 : Created a file : custom/Extension/application/Ext/Include/Calls.php

 

<?php
$beanList['Calls']     = 'CustomCall';
$beanFiles['CustomCall']     = 'custom/modules/Calls/CustomCall.php';
?>

 

Step 3: Created a file : custom/Extension/application/Ext/Include/Calls.php

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once 'modules/Calls/Call.php';
class CustomCall extends Call {
        function set_notification_body($xtpl, $call) {
                global $sugar_config;
                global $app_list_strings;
                global $current_user;
                global $app_list_strings;
                global $timedate;

 

                $notifyUser =($call->current_notify_user->object_name == 'User') ? $call->current_notify_user : $current_user;
                $calldate = $timedate->fromDb($call->date_start);
                $xOffset = $timedate->asUser($calldate, $notifyUser).' '.$timedate->userTimezoneSuffix($calldate, $notifyUser);

 

                if ( strtolower(get_class($call->current_notify_user)) == 'contact' ) {
                        $xtpl->assign("ACCEPT_URL", $sugar_config['site_url'].
                                  '/index.php?entryPoint=acceptDecline&module=Calls&contact_id='.$call->current_notify_user->id.'&record='.$call->id);
                } elseif ( strtolower(get_class($call->current_notify_user)) == 'lead' ) {
                        $xtpl->assign("ACCEPT_URL", $sugar_config['site_url'].
                                  '/index.php?entryPoint=acceptDecline&module=Calls&lead_id='.$call->current_notify_user->id.'&record='.$call->id);
                } else {
                        $xtpl->assign("ACCEPT_URL", $sugar_config['site_url'].
                                  '/index.php?entryPoint=acceptDecline&module=Calls&user_id='.$call->current_notify_user->id.'&record='.$call->id);
                }
                $xtpl->assign("CALL_TO", $call->current_notify_user->new_assigned_user_name);

 

                if($call->parent_type == 'Leads'){
                  $lead = new Lead();
                  $lead->disable_row_level_security=true;
                  $lead->retrieve($call->parent_id);
                  $account = new Account();
                  $account->disable_row_level_security=true;
                  $account->retrieve($lead->account_id);
                  $xtpl->assign("ACC_NAME", $accounts->name);
                }
                $xtpl->assign("CALL_SUBJECT", $call->name);

                $xtpl->assign("CALL_SUBJECT", $call->name);
                $xtpl->assign("CALL_STARTDATE", $xOffset);
                $xtpl->assign("CALL_HOURS", $call->duration_hours);
                $xtpl->assign("CALL_MINUTES", $call->duration_minutes);
                $xtpl->assign("CALL_STATUS", ((isset($call->status))?$app_list_strings['call_status_dom'][$call->status] : ""));
                $xtpl->assign("CALL_DESCRIPTION", $call->description);

 

                return $xtpl;
        }
}
?>

Outcomes