AnsweredAssumed Answered

Email Logic Hook - After save

Question asked by Bastien R on Jun 15, 2017
Latest reply on Jun 19, 2017 by Bastien R

Hello,

 

I would like to execute a specific code after an email is received. The code parses the email subject and do specific actions. I would like a more custom way than binding the email with a case from the subject ( [Case:XXX] to Case XXX)
However it seems that the hook is never executed.

 

I use sugar 7.7.2

 

I added those files and ran "Quick Repair and Rebuild".

 

./custom/Extension/modules/Emails/Ext/LogicHooks/test.php

<?php

   $hook_version = 1;

   $hook_array['after_save'][] = array(
      1,
      'Create case or add to case',
      'custom/modules/Emails/Emails_hook.php',
      'email_utils',
      'link_to_case'
);

./custom/modules/Emails/Emails_hook.php

<?php

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

 

   class email_utils
   {
      function link_to_case($bean, $event )
      {
         $GLOBALS['log']->debug('-- Link to case executed');

         // code goes here

      }

   }

?>

What am I doing wrong here ?

 

Thank you for your help

Outcomes