Adding a relate field form to the Convert Leads layout

I’ve been reading docs and toying around all day trying to get some customs fields in the convert leads layout. I’ve achieved some moderate success so far in modifying the metadata located at: custom/modules/Leads/metadata/convertdefs.php simply by adding:

array(
‘fieldname1’,
‘fieldname2’
)

and then rebuilding vardefs through the admin > repair dialog.

The problem is when I try to add a relate field. It doesn’t show up.

For related fields, the best I’ve gotten is,

array(
‘relatedcrop_c’ =>
array(
‘name’=>‘relatedcrop_c’, ‘displayParams’=>array(‘size’=>90),
‘link’ => ‘farm_Crops’,
‘label’ => ‘Crop’,
‘rname’ => ‘name’,
‘id_name’ => ‘Crops_id’,
‘type’ => ‘relate’,
‘customCode’ => ‘{html_options name=“Opportunityrelatedcrop_c” options=$fields.relatedcrop_c.options selected=$fields.relatedcrop_c.value}’
),

To show a field in the layout, but it doesn’t populate. Somehow I think I’m invoking something incorrectly or don’t understand the data structure.

Does anyone have any guidance?

Thanks in advance.

EDIT: It might also be worth mentioning that my relate field is a custom module.

And that I would also be satisfied if there was a way to convert text fields to relate fields in workflows, as a workaround for converting leads automatically instead of manually.

Just want to give a bump on this one. I’ve got the occasion to add a relate field in the conversion dialogue for the first time. I’ve added fields many times to the conversion dialogue, but they’ve always been normal fields just by adding to convertdefs.php

I have the need when I covert a lead and create an opportunity to relate the opportunity to another account (a lender). I’m not really sure how to do that.

So I figured this one out if anyone else needs to do this.

  1. modules/Leads/metadata/convertdefs.php

and save it in the custom directory as:

custom/modules/Leads/metadata/convertdefs.php

Now you will see in all the various sections of the convertdefs.php where fields are placed. In my case I want to add a relate field to the OPPORTUNITY section.

My relate field is called: accounts_opportunities_1. So you’d think you could just add 'accounts_opportunities_1 in one of the arrays just like ‘description’ is there and it would work. It doesn’t. If you do this, you will see the field but it’s not a proper relate field where you can select a related account. So… what you need to do is add this:

  1. Add an ARRAY for a relate field like this:
array (
            'name' => 'accounts_opportunities_1_name',
        
          ),

note: accounts_opportunities_1 is the name of my relationship field, also note: _name is appended to the end.

Voila, you now have a relate field in your convert lead screen.

(Don’t forget to repair and rebuild after you make changes to converdefs.php)

1 Like