AnsweredAssumed Answered

How can I populate values from a related account to my custom module on initial save?

Question asked by Sachin Sachin on Feb 7, 2014
Latest reply on Feb 17, 2014 by Ramblin Ramblin
I have custom module 'repair' & Account & repair module have one to many relationship,
i want fetch the account contact no in repair module,
for that i have created logic hook before_save,


$repairID = $bean->id;
 $bean->retrieve($repairID); 
if ($bean->accounts_rep_repair_1_name != "")
{
  $bean->load_relationship('accounts_rep_repair_1');
 $accountID = implode($bean->accounts_rep_repair_1->get());
  $account = new Account();   
$account->retrieve($accountID);
 $bean->contact_no_c =$account->phone_office;         

}

first time i create the repair case 7 save...the contact no shows blank but again if edit & save then it show account contact no?
but i want it on first save.
pls help..




Outcomes