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

  • When I edit that file how do I get it back into Sugar - do Sugar support have to do it for us

  •  ,

    it will depend the way your Sugar instance is hosted.

    For a cloud instance, you should be able to package it and deploy it using the module loader.

    For a on premise instance, you could use the same way (package) but also you can deploy it on the server by your self.

    In any case, you should be able to test it first on a staging environment before a live deployment.

    If you are a cloud customer, are you aware about the way to create a package ?

    Fred

  • Hi Fred

    I have done packages but only for completely new modules as we do not have a Staging environment - I have been on to Sugar about this but cannot get an answer. We are Cloud customers

Reply Children