custom subpanel in create view problem with getBeans

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.

Parents Reply
  • Thanks both of u to take your time to answer my question.

    I know i can do a few things to solve my problem, but i don't understand why in Opportunities and RevenueLineitems works without doing nothing and in custom module is not working.

    I check the Opportunities and RevenueLineItems module folder and check the .js and the .php class and logic hooks to see if Sugar is doing something more to save the lines, but disabling all logic hooks and .js that executes when sugar saves opportunities and revenuelineitems, is still working. So i don't know the difference between one module and another.

    Thanks all!

Children
No Data