Results 1 to 5 of 5

Thread: after converting lead to account - details still appear in leads

  1. #1
    sunchaser is offline Junior Member
    Join Date
    Feb 2009
    Posts
    3

    Default after converting lead to account - details still appear in leads

    Hi

    We have just started using sugar and have a issue that when you put the information in leads, which are ultimatley converted into an account, the information still appears as a lead.

    How is that possible?

    I would have thought once a lead become interested they are no longer a lead and then become an account and the lead information should no be viewable from the leads tab

    Daniel

  2. #2
    crmsiva's Avatar
    crmsiva is offline A Sugar Hero
    Join Date
    Jan 2009
    Location
    Chennai, India
    Posts
    1,130

    Default Re: after converting lead to account - details still appear in leads

    Converting Lead to Account will just copy the lead info and create a account with the lead details. And it wont delete the lead, which involved in the conversion. It is the sugar default functionality. If you want to delete the lead, you can change the code to do so.

  3. #3
    sugarcane is offline Sugar Community Member
    Join Date
    Apr 2005
    Location
    Chicago, IL
    Posts
    1,207

    Default Re: after converting lead to account - details still appear in leads

    Hi Daniel,

    Siva is right. The lead record is not deleted. You will notice that when you convert a lead into a contact/account, the status of the lead record automatically changes to a status of 'converted'. So you can easily filter out any leads by searching for any leads that do not have a status of converted.

    You will also notice that the new account and contact are linked to the lead record when you scroll down to the leads subpanel of these modules. This lets you know that this person originally entered your system as a lead and converted into a contact and account (as opposed to just being entered into your system as a contact and account directly). The leads module could contain fields that don't exist in the contacts and accounts module.

    This is the way the system was designed, so you would need to custom code to change this (for example, hide by default lead records with a status of converted). Another option could be to not use the Leads module at all, and instead just use a status field in the Accounts and Contacts modules to denote whether the record is a prospect, customer, supplier etc. This would depend on your business flow and needs.
    Intelestream has a great deal of experience hosting and customizing the SugarCRM application. Our company is made up by former employees of SugarCRM, and together we have over 50 years of experience working with the application. To learn more about us, please visit our website at www.intelestream.net or contact us directly at 800-391-4055 or by email at info@intelestream.net

  4. #4
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: after converting lead to account - details still appear in leads

    Hi Daniel

    A simple suggestion for accomplishing your requirement is to create a custom controller for Leads module (custom/modules/Leads/controller.php).
    Inside this custom controller you implement the function action_listview, inside that function you can override the $this->bean as an instance of a new class which extends the default Lead class.
    Inside that new class you implement the function create_new_list_query which is defined into SugarBean.
    This function generate the $ret_array array which contains all parts for composing the sql query for the ListView.
    You can modify the $ret_array['where'] to restrict the sql query for displaying only not converted Leads.

    Take a look at these two piece of code:

    custom/modules/Opportunities/controller.php
    PHP Code:
    <?PHP
    require_once('include/MVC/Controller/SugarController.php');
    require_once(
    'modules/Opportunities/OpportunityInListView.php');

    class 
    OpportunitiesController extends SugarController {
        function 
    action_listview(){
            
    $this->view_object_map['bean'] = $this->bean;
            
    $this->view 'list';
            
    $GLOBALS['view'] = $this->view;
            
    $this->bean = new OpportunityInListView();
        }
    }
    ?>
    custom/modules/Opportunities/OpportunityInListView.php
    PHP Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class 
    OpportunityInListView extends Opportunity {
        function 
    OpportunityInListView() {
            
    parent::Opportunity();
        }
        
        function 
    create_new_list_query($order_by$where,$filter=array(),$params=array(), $show_deleted 0,$join_type=''$return_array false,$parentbean$singleSelect false){
            
    $ret_array parent::create_new_list_query($order_by$where,$filter,$params$show_deleted,$join_type$return_array,$parentbean$singleSelect);
            
    $ret_array['select'] .= ", accounts.name account_name, jtl0.account_id account_id, jtl1.name agency_name, jtl2.name advertiser_name ";
            
    $ret_array['from'] .= "
    LEFT JOIN  accounts_opportunities jtl0 ON opportunities.id=jtl0.opportunity_id  AND jtl0.deleted=0 
    LEFT JOIN  accounts accounts ON accounts.id=jtl0.account_id AND accounts.deleted=0 AND accounts.deleted=0 
    LEFT JOIN  accounts jtl1 ON opportunities.agency_id=jtl1.id AND jtl1.deleted=0 
    LEFT JOIN  accounts jtl2 ON opportunities.advertiser_id=jtl2.id AND jtl2.deleted=0"
    ;
            
    $ret_array['where'] = str_replace("opportunities.agency_name""jtl1.name"$ret_array['where']);
            
    $ret_array['where'] = str_replace("opportunities.advertiser_name""jtl2.name"$ret_array['where']);

            return 
    $ret_array;
        }
    }
    ?>
    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  5. #5
    frown is offline Member
    Join Date
    Aug 2010
    Posts
    12

    Talking Re: after converting lead to account - details still appear in leads

    Old thread I know, but thanks so much as always, Andre! You are a gem!

    For those of us (like me!) new to code, the specifics to make it work to not show converted Leads are as follows (this is for a v6.2.0 instance).

    /custom/modules/Leads/controller.php:
    PHP Code:
    <?PHP
    require_once('include/MVC/Controller/SugarController.php');
    require_once(
    'custom/modules/Leads/LeadInListView.php');

    class 
    LeadsController extends SugarController {
        function 
    action_listview(){
            
    $this->view_object_map['bean'] = $this->bean;
            
    $this->view 'list';
            
    $GLOBALS['view'] = $this->view;
            
    $this->bean = new LeadInListView();
        }
    }
    ?>
    /custom/modules/Leads/LeadInListView.php
    PHP Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class 
    LeadInListView extends Lead {
        function 
    LeadInListView() {
            
    parent::Lead();
        }

        function 
    create_new_list_query($order_by$where,$filter=array(),$params=array(), $show_deleted 0,$join_type=''$return_array false,$parentbean$singleSelect false){
            
    $ret_array parent::create_new_list_query($order_by$where,$filter,$params$show_deleted,$join_type$return_array,$parentbean$singleSelect);
            
    $ret_array['where'] .= " AND converted = 0";

            return 
    $ret_array;
        }
    }
    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 2012-02-08, 01:16 PM
  2. Keeping Custom Lead Data When Converting Lead -> Account
    By matthewfong in forum General Discussion
    Replies: 11
    Last Post: 2010-11-23, 02:38 PM
  3. add field in account for while converting lead
    By sidh211 in forum Developer Help
    Replies: 2
    Last Post: 2008-09-01, 05:15 AM
  4. Replies: 0
    Last Post: 2007-03-08, 01:26 PM
  5. add account not working when converting lead
    By ricardo.reis in forum Help
    Replies: 0
    Last Post: 2005-10-07, 10:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •