Default value in a multiselect inherited from a field in another module

Hi all

I think I´ve seen an answer to this but can´t find it now - maybe I just dreamt it 

I have a multiselect field on the Contacts record (field B).

The same dropdown list is in a field on the Accounts record (field A).

When creating a new Contact, I want to give field B a default value that is the same as in the field A (on it´s Accounts related record). Basically field B = field A at that point.

How can I achieve taht?

Thanks,

KGM

  • Our case is display MultiSelect field from Accounts in Contacts:

    1. add field in record.php in /custom/modules/Contacts/clients/base/views/record:

    3 =>
    array (
       'name' => 'account_industry', //your field name
       'type' => 'multienum',
       'options' => 'industry_dom', // your dom
       'isMultiSelect' => true,
       'readonly' => true,
       'label' => 'LBL_ACC_INDUSTRIES',
    ),

    2. define field in vardef in /custom/Extension/modules/Contacts/Ext/Vardefs/sugarfield_{your_field}.php:

    $dictionary['Contact']['fields']['account_industry'] = array(
       'name' => 'account_industry', // your field name in Contacts
       'rname' => '{your_field_in_Accounts}',
       'id_name' => 'account_id',
       'vname' => 'LBL_ACCOUNT_NAME',
       'join_name' => 'accounts',
       'type' => 'relate',
       'link' => 'accounts',
       'table' => 'accounts',
       'isnull' => 'true',
       'module' => 'Accounts',
       'source' => 'non-db',
    );

    Hope it will help you guys!

    Made by [iZeno].