AnsweredAssumed Answered

cases module load_relationship add

Question asked by Banning Stuckey on Mar 12, 2015
You'll have to excuse me I haven't been to the community in a long time and I am use to the old forums so please don't get to angry with me if I am using this new stuff incorrectly... On the forums there was a place for developer to go get help so I hope I am in the right spot... sorry if I am not.

Sugar Version 6.5.18

I am trying to load a relationship and then add a new record to that relationship with my custom module. It works with every other module except cases it gives me this error.

Fatal error:  Cannot access empty property in /opt/bitnami/apps/sugar/data/Relationships/One2MRelationship.php on line 156

here is my code
$relationshipName = $_REQUEST['relationshipName'];  $parentModule = $_REQUEST['parentModule'];  $parentID = $_REQUEST['parentID'];
$focus = BeanFactory::getBean($parentModule, $parentID);
$newComm = new posim_CommHub(); 
$newComm->description = nl2br(strip_tags(html_entity_decode($_REQUEST['newMessage']), '<ul><ol><li>'));
$newComm->save(); 
$focus->load_relationship($relationshipName);
$focus->$relationshipName->add($newComm->id);  $focus->save();

Let me know if there is any other information I can provide. I am at a loss as to why I am getting this error only on the cases relationship.

Outcomes