Hi Francisco
Thank you for clarify your needs, now I fully understand.
I "believe" the Project is related to an Account, Opportunity and a Contact, so you are able to fetch the related ids without big deal:
retrieve the Project;
under project load relationship to Accounts, Contacts and Opportunities and fetch the related ids
PHP Code:
$project->retrieve($bean->project_id);
$project->load_relationship('accounts');
$account_id_list = $project->accounts->get(); // this returns an array containing all related Accounts, hopefully there is only one.
$account_id = array_shift($account_id_list);
$project->load_relationship('contacts');
$contact_id_list = $project->contacts->get();
$contact_id = array_shift($contact_id_list);
$project->load_relationship('opportunities');
$opportunity_id_list = $project->opportunities->get();
$opportunity_id = array_shift($opportunity_id_list);
Regards
Bookmarks