AnsweredAssumed Answered

how to customize the from parameter of an email in 6.x?

Question asked by Rodolfo Tuble on Jul 4, 2016

I want to customize the from address of an email depending on the template used, My plan was to use jquery to change the from address but when I tried to use logic hooks to insert my new javascript file it interrupted the flow of the module and resulted in an error. So I want to ask is how do I add a custom javascript file in the email module without using the logic hooks, also is there an alternative way for me to change the from address of an email?

 

My Logic hooks:

 

logic_hooks.php

    $hook_array['after_ui_frame'] = Array();

    $hook_array['after_ui_frame'][] = Array(

        1,

        'after_ui_frame example',

        'custom/modules/Emails/logic_hooks_class.php',

        'logic_hooks_class',

        'after_ui_frame_method'

    );

 

logic_hooks_class.php

    if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class logic_hooks_class{

         function after_ui_frame_method($event, $arguments){

            $this->call_js();

        }

        protected function call_js(){

  echo '<script src="custom/modules/Emails/email.js"></script>';

        }

    }

 

email.js

$(document).ready(function(){

  alert("test");

});

 

Error for using logic hooks:

index.php:1 Uncaught SyntaxError: Unexpected token < in JSON at position 147 index.php

Outcomes