I've seen people use this, however it just doesn't work for me.
PHP Code:
$childOpps = $bean->get_linked_beans('opportunities','Opportunity');
foreach($childOpps as $opp)
{}
it has the same error as the previous one. i can't seem to figure this out. i thought i may be able to get the account associated with this bean and then iterate over the opportunities on there, but it didn't work either.
EDIT:
Found out that the reason there is an error is because opportunities is not a link name for opportunity. however since it *is* for an account, i did the following and it works beautifully. now i can delete and recreate opportunities for my forecasting, woot!:
PHP Code:
$account = new Account();
$account = $account->retrieve($bean->account_id);
$oops = $account->get_linked_beans('opportunities','Opportunity');
foreach ($opps as $opp)
{
if ($opp->name == $bean->name)
$opp->mark_deleted($opp->id);
}
Bookmarks