Do not show lead to user where lead status is Dead or any defined status

Hi Team ,

My requirement is not to show the lead to any user (except admin) , where lead status is any pre-define value .
Please guide some way to do this .

Thanks in advance

I’ve taken a piece of code from https://hirenprajapati.wordpress.com/2013/04/19/change-listview-query-in-sugar-crm/ and modified it a bit as per your needs.

Copy view.list.php from modules/Leads/views to custom/modules/Leads/views and copy paste the below code inside the class LeadsViewList

function listViewProcess() {
        global $current_user;
        $this->processSearchForm();
        if(!$current_user->is_admin) 
            $this->params['custom_where'] = ' AND leads.status != "Dead" ';
       
        if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
            $this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
            $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
            echo $this->lv->display();
        }
    }
1 Like

Thanks for the help , it is working as expected . :slight_smile: