AnsweredAssumed Answered

Pass values between different logic hooks

Question asked by Ramon Marcondes on Feb 13, 2017
Latest reply on Feb 13, 2017 by Francesca Shiekh

Hello.

I'm using Sugar Enterprise 7.8.

How do I pass some values between logic hooks that are in different files and classes?

 

I tried to do a before_save and a after_save hook in the same class, but strangely it didn't worked...

I followed this Sugar Developer tutorial:

Doing before/after field comparisons in after_save logic hooks « Sugar Developer Blog – SugarCRM 

 

And even posted about this problem I'm having:

Cannot use 2 Logic Hooks in same Class, only separately 

 

I've tried to use the Configurator object to set one parameter in the before_save, and then get it in the after_save hook, but it didn't work too:

 

before_hook example:

// Configurator
        require_once 'modules/Configurator/Configurator.php';
        $configuratorObj = new Configurator();
       
        //Load config
        $configuratorObj->loadConfig();
        //Update a specific setting
        $configuratorObj->config['envia_gerente'] = self::$enviaGerente;
        //Save the new setting
        $configuratorObj->saveConfig();     

after_hook example:

// Configurator
        require_once 'modules/Configurator/Configurator.php';
        $configuratorObj = new Configurator();
        //Load config
        $configuratorObj->loadConfig();
        //Use a specific setting
        self::$enviaGerente = $configuratorObj->config['envia_gerente'];

 

Any help would be appreciated.

Thanks.

Best regards,

Ramon

Outcomes