How to get Account's value type at Contact's custom field

Morning,

I’m trying to get the Account’s value type and show it at Contact’s custom field that I have made in the same way that Account’s type field (dropdown with the same values).

The problem is that when i create a new contact i would like this custom field filled with the same vale was put at account, as it happens with another fields like phone, country, etc.

I have already try to edit the editviewdefs.php from contact module but maybe I’m doing something wrong or the solution that I found it doesnt work. How could I do this?

I’m a bit stuck and a little help would be awesome.

Thank you,
Best Regards.

Hello,

Can you please detail a bit more the process you have done already?

1 Like

Sure JoĂŁo,

The first steps that I made until now are:

  1. Create a new field at Contact module with Dropdown data type
  2. Edit the Edit View layout to have access to the new field

After this, I went to “custom/modules/Contacts/metadata” and edited the "editviewdefs.php adding just the last line:

array (
0 =>
array (
‘name’ => ‘account_name’,
‘displayParams’ =>
array (
‘key’ => ‘billing’,
‘copy’ => ‘primary’,
‘billingKey’ => ‘primary’,
‘additionalFields’ =>
array (
‘phone_office’ => ‘phone_work’,
‘contact_type_c’ => ‘account_type’,
),
),
),

Im not sure if im doing right or wrong, do you know if im missing some code?

Thank you.

Hi!!

Well 1st step I agree! In the 2nd process I desegree.

Instead you edit the edit view in metada folder, I think that it is a better way to use the file in the views folder (both edit and detail view).

In those files, edit the Display function. Once you have the Contact bean in your $bean variable, get the Account id from your $bean, query for it (using PHP and Sugar framework) and give to your contact’s dropdown field the value that your query return.