Button or link to convert lead to opportunity from list view

Anyone know how to edit lead list view so one of the columns has a button or link that you can click on to convert the lead to an opportunity instead of having to go into detail view and do it?

Parents
  • Hi Jeff,

    There are probably a few ways you could do this, but here's the way I was able to get it working. First, create a custom TextField (I named mine "Convert Link"). Then, create two logic hooks. Here is my custom/modules/Leads/logic_hooks.php file:

    <?php
    $hook_version = 1;
    $hook_array = Array();
    $hook_array['before_save'] = Array();
    $hook_array['before_save'][] = Array(1, 'Populate Convert Link', 'custom/modules/Leads/LeadsLogicHooks.php', 'LeadsLogicHooks', 'before_save_method');
    $hook_array['process_record'][] = Array(1, 'Format Convert Link', 'custom/modules/Leads/LeadsLogicHooks.php', 'LeadsLogicHooks', 'process_record_method');
    

    And here is my custom/modules/Leads/LeadsLogicHooks.php file:

    <?php
    if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
    
    class LeadsLogicHooks
    {
        function before_save_method($bean, $event, $arguments)
        {
            if(empty($bean->convert_link_c)) {
                // Replace {site_url} with the actual URL to your Sugar instance
                $bean->convert_link_c = 'http://{site_url}/index.php?module=Leads&action=ConvertLead&record=' . $bean->id;
            }
        }
    
        function process_record_method($bean, $event, $arguments)
        {
            if(!empty($bean->convert_link_c)) {
                $bean->convert_link_c = '<a href="' . $bean->convert_link_c . '">Convert</a>';
            }
        }
    }
    

    Note that the Convert link won't show up for existing Leads until they have been saved (allowing the before_save logic hook to run), but all new Leads should have it show up right away. I hope that helps!

    -Alan

  • Hello Alan Beam,

    This development is work for sugarCRM 7.* version?

    -BPATEL

Reply Children
No Data