AnsweredAssumed Answered

custom subpanel in create view problem with getBeans

Question asked by Diego Celdrán on Oct 18, 2017
Latest reply on Oct 24, 2017 by Diego Celdrán

Hello all,

 

In the Enterprise version of sugar, you can add at the same time Opportunities with revenuelineitems.

If you create a logic hook in the before_save of revenuelineitems and u want to load the relation with Opportunities and do getBeans() it works fine:

if ($bean->load_relationship('opportunities')) {
    $getbeans = $bean->opportunities->getBeans();
}

Now i create two modules with the module builder (without customization, just basic module), one module called "orders" and other "order lines", i add a relationship: 1:n -> 1 order can have multiple order lines. 

After that i create the subpanel of order lines into the create view of orders and just works fine, i can add orders with multiple lines at the same time.

The problem is if i create a logic hook before_save just like before and i load the relationship and do the getBeans() method, this return an array of 0 items.

 

I check the relationship name in Studio and i use debugger to debug the $bean object too to see the beans of the relationship and always has 0 beans.

Outcomes