AnsweredAssumed Answered

Set Relationship is not working on sandbox Sugarcrm

Question asked by Jagdish Shirsat on Apr 6, 2017
Latest reply on Apr 6, 2017 by Jagdish Shirsat

This is m logic hook After Save , this logic hook is perfectly working on my local machine.
But it is not working on sandboxcopy. I asked this question to Sugar Support team ,
They found that Set_relationship is not working .
But my question is why this is working on local or is there any alternate way to write this code, where i am wrong ?

classRHLogicHook{functionReportingTeam($bean,$event, $arguments){

   if(isset($arguments['isUpdate'])&& $arguments['isUpdate']==false){ 

        $reporting_head =BeanFactory::retrieveBean('Contacts', $bean->contact_id_c);          

       $contact =BeanFactory::retrieveBean('Contacts', $bean->contacts_rh_reporting_head_1contacts_ida);     

       $reporting_team =new RH_reporing_team();   

        $reporting_team->contact_id_c = $contact->id;     

       $reporting_team->save();     

       $dataset = array('contacts_rh_reporing_team_1contacts_ida'=> $reporting_head->id,'contacts_rh_reporing_team_1rh_reporing_team_idb'=> $reporting_team->id,);  

          $reporting_team->set_relationship('contacts_rh_reporing_team_1_c', array(),false,false, $dataset);

}

}

}

Outcomes