Hi all,
I have added a logic hook which is not working as expected. Below is the complete code:
logic_hooks.php
and my logic_hook handler is:PHP Code:<?php
$hook_version=1;
$hook_array=array();
$hook_array['after_save']=array();
$hook_array['after_save'][]=array(1,'SetData','custom/modules/Opportunities/SetData/SetData.php','SetData','SetData');
?>
data_id_c is a Relate field which is related to the Opportunities module. I want to set acc_data_id_c to the Opp.data_id_c. It works fine and updates the DB perfectly when I look up the accounts_cstm table, but when I try to view the Account my Apache crashes and it doesn't work until I clear off the acc_data_id_c field in accounts_cstm table.PHP Code:<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class SetData {
function SetData($bean, $event, $args) {
$dbm = DBManagerFactory::getInstance();
$sql="update accounts_cstm
set acc_data_id_c = '".$bean->fetched_row['data_id_c']."'
where id_c='".$account_data['id']."'";
$dbm->query($sql,true,"Error updating Opportunities: ");
}
}
}
?>
Let me know if these details are sufficient. Any kind of help is appreciated.
Thanks in advance


LinkBack URL
About LinkBacks



Reply With Quote


Bookmarks