Try to fetch related/linked Contracts - but result is always empty - why?

I try to get the contracts of an Opportunity. The Contract is seen and listed in the subpanel.

If i try to load related Contracts, i always get only an empty array.

/** @var Opportunity $quote */
$opp = \BeanFactory::getBean('Opportunities', $opportunitiesId);
$opp->load_relationship('contracts');
$contracts = $opp->contracts->get();

Any ideas what i am doing wrong? Working with Sugar 10.

Also tried "getBeans()" or similar functions. Result always empty Array :-( 

Parents Reply Children
  • André, you are awesome. That´s the point. It´s a "custom" Contract Modul. Haven´t thought on this (was not me). No it works. Just for reference the updated code which works now as expected.

    Thank you.

    /** @var Opportunity $quote */
    $opp = \BeanFactory::getBean('Opportunities', $opportunitiesId);
    $opp->load_relationship('opportunities_contracts_1');
    $contracts = $opp->{"opportunities_contracts_1"}->getBeans();