Is there a way to prevent the phone_office field from being populated from the account into the contact?

Hi everyone,

I'm currently seeking a way to prevent the contact's phone_office field from being populated with the account's phone_office when establishing a relationship between them.

Here's the code I've implemented:

```php

$dictionary['Contact']['fields']['account_name']['populate_list'] = array(
'billing_address_street' => 'primary_address_street',
'billing_address_city' => 'primary_address_city',
'billing_address_state' => 'primary_address_state',
'billing_address_postalcode' => 'primary_address_postalcode',
'billing_address_country' => 'primary_address_country',
);

```

I added this code to custom/Extension/modules/Contacts/Ext/Vardefs/sugarfield_account_name.php.

However, upon creating the relationship, I encountered an error, and the contact was marked as deleted=1. I also attempted making the change within modules/Accounts/vardefs.php, but encountered the same issue. I'm uncertain if there's something additional that needs to be done within the Accounts module.

Any advice or insights would be greatly appreciated. Thank you!

  • You did exactly the right thing.

    I copied your code and it worked fine in my test environment.

    Did you call a Quick Repair and Rebuild after the change?

    Please check all touched files for any wrong characters.

    In cache/modules/Contacts/Contactvardefs.php you should find the changed field definition for account_name:

        'account_name' => 
        array (
          'name' => 'account_name',
          'rname' => 'name',
          'id_name' => 'account_id',
          'vname' => 'LBL_ACCOUNT_NAME',
          'join_name' => 'accounts',
          'type' => 'relate',
          'link' => 'accounts',
          'table' => 'accounts',
          'isnull' => 'true',
          'module' => 'Accounts',
          'dbType' => 'varchar',
          'len' => 255,
          'source' => 'non-db',
          'unified_search' => true,
          'populate_list' => 
          array (
            'billing_address_street' => 'primary_address_street',
            'billing_address_city' => 'primary_address_city',
            'billing_address_state' => 'primary_address_state',
            'billing_address_postalcode' => 'primary_address_postalcode',
            'billing_address_country' => 'primary_address_country',
          ),
          'populate_confirm_label' => 'TPL_OVERWRITE_POPULATED_DATA_CONFIRM_WITH_MODULE_SINGULAR',
          'importable' => 'true',
          'exportable' => true,
          'export_link_type' => 'one',
          'audited' => true,
          'massupdate' => true,
          'hidemassupdate' => false,
          'help' => 'modified field',
          'duplicate_merge' => 'enabled',
          'duplicate_merge_dom_value' => '1',
          'merge_filter' => 'disabled',
          'reportable' => false,
          'calculated' => false,
        ),

    If you want to be sure that the polulate_list is added at the end of the definition you can write it to custom/Extension/modules/Contacts/Ext/Vardefs/_override_account_name.php and try a Quick Repair and Rebuild again.