How to add a custom filed in convert lead layout in suite CRM.

How to add a custom filed in convert lead layout in suite CRM Or How to add an assigned to filed in convert lead layout in suite CRM.
Suite CRM version 7.7.6
PHP Version - 7.0

You need put some changes in \modules\Leads\metadata\convertdefs.php

Don’t forget to move it to custom directory.

1 Like

I already did this but not able to see that field.
can you help me how can I achieve this?

Thanks.

Here’s my notes on how I’ve done it in the past:

How to Add/Change Fields in the CONVERT LEAD Process

There are two things you might want to do 1) add fields and 2) auto populate a field from the lead to the contact. Below are examples of each.

How to Populate Custom Fields on Convert
You can do this by editing the ‘convert-main.php’ file. Copy that file from /modules/Leads/clients/base/layouts/convert-main/convert-main/php to /custom/modules/Leads/clients/base/layouts/convert-main/convert-main/php.

When that’s done, you can change the fieldmappings.

In the example below, I map my phone_work from my lead, to my phone_office in opportunities.

array(
    'module' => 'Opportunities',
    'required' => false,
    'copyData' => true,
    'duplicateCheckOnStart' => true,
    'duplicateCheckRequiredFields' =>
        array(
            'account_id',
        ),
    'fieldMapping' =>
        array(
            'name' => 'last_name',
            'phone_work' => 'phone_office',
        ),
    'dependentModules' =>
        array(
            'Accounts' =>
                array(
                    'fieldMapping' =>
                        array(
                            'account_id' => 'id',
                        ),
                ),
        ),
    'hiddenFields' =>
        array(
            'account_name' => 'Accounts',
        ),
),

I found the name and ida field names in the vardefs.ext.php of the Lead and Opportunities modules: …/custom/modules/MODULE/Ext/Vardefs/

How to Add Fields to the Convert Dialoge

  1. Find…

modules/Leads/metadata/convertdefs.php

and save it in the custom directory as:

custom/modules/Leads/metadata/convertdefs.php

  1. Add the fields you’d like to the corresponding target Module’s array within the file…

$viewdefs['Contacts']['ConvertLead'] = array(

array(
    'description',
),

// Added below description in order to copy this value from Leads to Contacts module
array(
    'do_not_call' 
),

  1. Admin → Repair → Quick Repair and Rebuild

To add a new panel to covertdefs.php, for instance Cases…


$viewdefs['Cases']['ConvertLead'] = array(
    'copyData' => false,
    'required' => false,
    'templateMeta' => array(
        'form'=>array(
            'hidden'=>array(
                '<input type="hidden" name="opportunity_id" value="{$smarty.request.opportunity_id}">',
                '<input type="hidden" name="case_id" value="{$smarty.request.case_id}">',
                '<input type="hidden" name="bug_id" value="{$smarty.request.bug_id}">',
                '<input type="hidden" name="email_id" value="{$smarty.request.email_id}">',
                '<input type="hidden" name="inbound_email_id" value="{$smarty.request.inbound_email_id}">'
            )
        ),
        'maxColumns' => '2',
        'widths' => array(
            array('label' => '10', 'field' => '30'),
            array('label' => '10', 'field' => '30'),
        ),
    ),
    'panels' =>array (
        'LNK_NEW_CASE' => array (
            array (
                array('name'=>'name', 'displayParams'=>array('size'=>90)),
            ),
            array (
                'status', 'priority'
            ),

            array (
                array('name' => 'description', 'displayParams' => array('rows'=>10, 'cols'=>90) ),
            ),
        )
    ),
);
2 Likes

Hi,
I create panel like your examples
$viewdefs[‘Cases’][‘ConvertLead’]

but the code behind to create Cases is not included in Suite
Do you have implemented it?

Thank’s

Hey, I don’t think I’ve ever tried the 3rd option of adding a new module, the other two options I have tried and they do work. I originally got this info from here:

https://stackoverflow.com/questions/19562899/edit-lead-convert-page-in-sugarcrm-ce

You can double check there if there is any further info to help you.

Thanks for this, I was able to add a custom field for opportunities to the convert lead page :slight_smile: