AnsweredAssumed Answered

record not saving  before_relationship_add logic hook Enterprise

Question asked by KarenV KarenV on Jun 24, 2015
Latest reply on Jun 26, 2015 by KarenV KarenV
I've written the following logic hook: 

  $hook_version =1;
  $hook_array = Array();

  $hook_array['before_relationship_add'] = Array();
  $hook_array['before_relationship_add'][] = Array(

   //String to identify the hook

   //PHP file path

   //The Class method exists


And now the function itself:

  if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Point');

  class hoover_account_class
   function data_copy($bean, $event, $arguments)
    if ($bean->load_relationship('accounts_hoovl_hoovers_library_1'))
     $duns = $bean->accounts_hoovl_hoovers_library_1->d_u_n_s_number_c; //pulling data from Hoover's
     $bean->hoov_duns_num_c = $duns; //copying data to Accounts

When I link a Hoover's Library record to Accounts, this field hoov_duns_num should populate with the data from the Hoover's Library record. Instead, the Account record doesn't save. Is there something wrong with my code?

Thank you,