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