How to populate fields in Contacts and Opportunities during Lead Conversion?

Hello All,

I am customizing SugarCRM 7.2.0. I have requirement while convert the Lead. Need to fill some dropdown fields on the Contacts and Opportunities. Has anybody try out this thing for Lead Convert ?

Thanks.
  • Leads fields with matching field names in Contacts and Opportunities will be auto-copied (in v7.2.0)... and if the dropdown name fields use the same dropdown lists they should populate upon conversion.
    [Else], logic hook on Leads should provide the means to update other Contacts and Opportunities fields:

    $stat=$bean->status;
    if ("Converted" == $stat)  {
      $contact_id = $bean->contact_id; ...=BeanFactory::getBean('Contacts',$contact_id);
       $op_id = $bean->opportunity_id;...=BeanFactory::getBean('Opportunities',$op_id);
    ...
    }
    Hope this helps.
  • Hello John,
    You can accomplish this without any coding using workflow. SierraCRM's Process Manager Enterprise will allow you to create a process on Lead Convert. The process task will be to update a related module - in this case, you will choose the Opportunity - then you can update any field in the Opportunity two ways: 1 - by Value, set a field in the Opportunity to a fixed value - for example, set the Lead Source to some value. 2 - copy a value from the Lead and set a field on the Opportunity to this value.

    Check out the product at http://www.sierracrm.com. We offer a 30 day free trial.
    Thanks
    Bill Convis
    CTO
    SierraCRM, Inc.

  • 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',
            ),
    ),


  • Hi All ,

    I am facing Same Problem .. anyone has idea how to Populate / link custom relationship field with the Opportunities. I am Using Sugar Pro 7.6.0.0. Plz help me

    I had created one custom relationship with leads. same custom module has relationship with Opportunities modules also.. So I have same field in Opportunities and Lead. while converting Lead , I need to Populate Relationship field value in the Opportunities module. 

    Thanks in Advance

  • Hi SKS,


    I am having the same issue as you. Can you please advise what is the solution?


    Thanks

  • I found the answer here: https://community.sugarcrm.com/thread/18276:

    Copy convert-main.php from ../modules/Leads/clients/base/layouts/convert-main/convert-main/ * to /custom/modules/Leads/clients/base/layouts/convert-main/convert-main/.

    Edit the fieldMapping array of the record type you want to populate.  In my case, I created a custom module called Broker which I then related to Leads and Opportunities.  I wanted the Relationship Field on the Opportunity Convert section to auto-populate.  So this is what my fieldMapping array looked like:

    'fieldMapping' =>
    array(
    'name' => 'opportunity_name',
    'phone_work' => 'phone_office',
    'tai_broker_opportunities_1_name' => 'tai_broker_leads_1_name',
    'tai_broker_opportunities_1tai_broker_ida' => 'tai_broker_leads_1tai_broker_ida'
    ),

    I found the name and ida field names in the vardefs.ext.php of the Lead and Opportunities modules: ../custom/modules/MODULE/Ext/Vardefs/
  • Hi Sundar Kumar,

    I'm facing same issue. I have create on custom module and relation of that custom module with Accounts and Lead, but now if I convert lead the the relationship value is not populate. 

    can you please share the solution for this.

    Thanks.