Convert Lead

Hi

I want to copy field when converting a lead but unfortunately the fields in the Account and Opportunity module do not have the same names as the field in the lead so they are not copying - what is the best way to resolve this ?

Do I have to create new fields and migrate the old data ?

Parents
  • Hi  ,

    you can do it by editing the fieldMapping property, in a file called convert-main.php that must be copy to /custom/modules/Leads/clients/base/layouts/convert-main/convert-main/ from modules/Leads/clients/base/layouts/convert-main/convert-main/ (of course only if there is no current override that you can directly edit) and add the mapping you are expecting for the Account and then for the Opportunity.

    It will probably looks like this

    $viewdefs['Leads']['base']['layout']['convert-main'] = [
        'modules' => [
            [
                'module' => 'Contacts',
                'required' => true,
                'copyData' => true,
                'duplicateCheckOnStart' => true,
                'fieldMapping' => [
                ],
                'hiddenFields' => [
                    'account_name' => 'Accounts',
                ],
            ],
            [
                'module' => 'Accounts',
                'required' => true,
                'copyData' => true,
                'duplicateCheckOnStart' => true,
                'duplicateCheckRequiredFields' => [
                    'name',
                ],
                'contactRelateField' => 'account_name',
                'fieldMapping' => [
                    'name' => 'account_name',
                    'billing_address_street' => 'primary_address_street',
                    'billing_address_city' => 'primary_address_city',
                    'billing_address_state' => 'primary_address_state',
                    'billing_address_postalcode' => 'primary_address_postalcode',
                    'billing_address_country' => 'primary_address_country',
                    'shipping_address_street' => 'primary_address_street',
                    'shipping_address_city' => 'primary_address_city',
                    'shipping_address_state' => 'primary_address_state',
                    'shipping_address_postalcode' => 'primary_address_postalcode',
                    'shipping_address_country' => 'primary_address_country',
                    'phone_office' => 'phone_work',
                ],
            ],
            [
                'module' => 'Opportunities',
                'required' => false,
                'copyData' => true,
                'duplicateCheckOnStart' => false,
                'duplicateCheckRequiredFields' => [
                    'account_id',
                ],
                'fieldMapping' => [
                    'name' => 'opportunity_name',
                    'phone_work' => 'phone_office',
                ],
                'dependentModules' => [
                    'Accounts' => [
                        'fieldMapping' => [
                            'account_id' => 'id',
                        ],
                    ],
                ],
                'hiddenFields' => [
                    'account_name' => 'Accounts',
                ],
                'enableRlis' => true,
                'requireRlis' => true,
                'copyDataToRlis' => true,
            ],
        ],
    ];
    

    Fred

Reply Children
No Data