AnsweredAssumed Answered

How to test after_restore logic hook action in SugarCRM v7.6.2 Ent Edition?

Question asked by Udayakumar Sarangapani on Mar 30, 2016
Latest reply on Mar 31, 2016 by Udayakumar Sarangapani

Dear Sugar Experts,

I have deleted an account record from my local SugarCRM.

I have the below logic hook code for Accounts module:

Logic Hook file location: /custom/modules/Accounts/logic_hooks.php

<?php

$hook_version = 1;

$hook_array = array();

$hook_array['after_restore'] = array();

    $hook_array['after_restore'][] = array(

       1,

       'after_restore example',

       'custom/modules/Accounts/AccountsLogicHook.php',

       'AccountsLogicHook',

       'restoreData'

   );

?>

Logic Hook file location: /custom/modules/Accounts/AccountsLogicHook.php

<?php

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

class AccountsLogicHook {

function restoreData($bean, $event, $arguments) {

$GLOBALS['log']->dale("KKKKK" . print_r($bean, true));

$GLOBALS['log']->dale("KKKKK" . print_r($arguments, true));

}

}

?>

How to trigger the after_restore action (i.e., how to undelete an existing deleted record)?

I have executed the below query in MySQL command line:

UPDATE accounts SET deleted='0' WHERE (id='<account id>' AND deleted='1');

No action triggered. Please help out.

Thanks.

-Uday

Alex Nassi

Outcomes