Auto populating data to new Contact from account

Hi All,

I use sugarcrm 7.9

I create new Contact. I would like to auto populating phone_fax of Account to new Contact.

I tried with this: SugarCRM: Populating fields using a Relate field « Sugar Developer Blog – SugarCRM 

I  created file ./custom/Extension/modules/Contacts/Ext/Vardefs/vardef.ext.php

with below content:

----------------

<?php
$dictionary['Contact']['fields']['phone_fax']['populate_list'] = array('id','name','phone_fax');

$dictionary['Contact']['fields']['phone_fax']['field_list'] = array('account_id_c','account_name','phone_fax');
?>

-----------------

After Quick Repair I got this:

What should I do more? (I would also like to fill phone fax to new contact)

Thanks

Parents
  • Check out the original vardefs in Contacts

    modules/Contacts/vardefs.php

     

    the populate_list for those fields listed in the popup on your display are on the account_name, which makes sense: when you select the account, then get the fields related to that account.

     

    Notice, for example,  phone_office mapped to phone_work. The field is called phone_office in Accounts and phone_work in Contacts.

     

    So I believe that what you really want is to add an element to the Contact=>fields=>account_name=>populate_list array

    hence:

    $dictionary['Contact']['fields']['account_name']['populate_list']['phone_fax'] = 'phone_fax';

    HTH

    FrancescaS

     

Reply
  • Check out the original vardefs in Contacts

    modules/Contacts/vardefs.php

     

    the populate_list for those fields listed in the popup on your display are on the account_name, which makes sense: when you select the account, then get the fields related to that account.

     

    Notice, for example,  phone_office mapped to phone_work. The field is called phone_office in Accounts and phone_work in Contacts.

     

    So I believe that what you really want is to add an element to the Contact=>fields=>account_name=>populate_list array

    hence:

    $dictionary['Contact']['fields']['account_name']['populate_list']['phone_fax'] = 'phone_fax';

    HTH

    FrancescaS

     

Children