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:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    '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',
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    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.