AnsweredAssumed Answered

after_relationship_add logic hook update query doesn't work

Question asked by PS PS on May 19, 2014
Latest reply on Jun 14, 2016 by Alexander Cope-Norris
I have created a after_relationship_add logic hook in cases module and in this module there is a custom field for one of the custom module relationship data to be inserted. The hook is called properly, and everything is working fine. but when I am updating the case record in hook logic, the update query is not working. But if I add a die(); statement after update query execution, the record gets updated. logic hook code is given below

public function updateData($bean, $event, $arguments){  

$caseid = $bean->id;
$dataid = $arguments['related_id'];
$query = "SELECT name FROM data1_data where id = '" .$dataid. "'";
$dataresult = $GLOBALS['db']->query($query , false);
$dataname = "";
while (($row = $GLOBALS['db']->fetchByAssoc($dataresult )) != null) {
       $dataname = $row['name'];               

$newQuery = 'UPDATE cases_cstm SET data_c = "'.$dataname.'" where id_c = "'.$caseid.'" ';
$newResult = $GLOBALS['db']->query($newQuery);   

/* here when die() statement is added update query executes properly and after removing die(); statement nothing happens.*/


Can any one help me in this issues?