AnsweredAssumed Answered

How to create a logic hook to create Relationship

Question asked by Ajit Agarw on Aug 7, 2016
Latest reply on Aug 8, 2016 by Bhargavi Patel

Hi

I am trying to create a logic hook to insert record in relationship table.

I have created relation between Opportunity and a custom module Opportunity Items.

this is my code:

                       $oppItemsId = '' ;

                       $OpportunityId='';
                        $rel_name = 'opportunities_s_opportunity_items_1';

 

                        $oItems = new Opportunity();
                      
                        $oItems = retrieve($OpportunityId);                       
                        $oItems->load_relationship($rel_name);
                        $oItems->$rel_name->add($oppItemsId);  
                        $oItems->save();

it will give error "Call undefined function  retrieve() " .

 

can any one please help me.

 

Thank you in advance.

Outcomes