AnsweredAssumed Answered

Retrieve relation table data on a many-to-many relationship

Question asked by rohillion on Sep 10, 2015
Hi,
I'm having problems on retrieving values from the additional fields inside a pivot table between two modules. Let's say:

ModuleA relates many-to-many with ModuleB through ModuleAModuleB table.

I want to retrieve in a logic hook or edit.view.php the data inside the table ModuleAModuleB.
I manage myself to retrieve those additional values to a sub panel by following this tutorial:
http://developer.sugarcrm.com/2011/07/22/howto-add-additional-data-to-many-to-many-relationship-for-... 

... but when I do:

if (ModuleA->load_relationship('ModuleB')) {
        ModuleB_beans = ModuleA->ModuleB->getBeans();
}

ModuleB_beans has my additional fields inside (the ones in the pivot table), but empty.

I have read here that sugar lets you add extra columns into a pivot table, actually, Sugar itself add a "deleted" and a "date_modified" fields to it. 

How do we do to retrieve them???

I am working on a Sugar 6.5.16 CE.

Many thanks in advance!
Rodrigo.

Outcomes