How can you populate active and inactive users in Assigned To field?

Hi,

I am using SugarCRM Professional 7.2

Module: Meetings

How to populate inactive users in Assigned To field?

By default only active users are appearing.
The logic is when we create a new user then that user becomes also a employee and when inactive that user then that user not able to login but that user still showing as a employee.

Here I need to assign the record to a employee who is not a user means when I will go for select then both active and inactive users show please help

Regards
  • Hello Shaji,

    You can do this with an upgrade safe code level customization using the following steps:

    1. In your Sugar File System, create the following directories if they don't exist:
    ./custom/modules/Users/metadata/ 
    2. Create a new file with the following name:
    popupdefs.php
    3. Copy and paste the below code into this file:
    <?php
            
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
    /*********************************************************************************
     * By installing or using this file, you are confirming on behalf of the entity
     * subscribed to the SugarCRM Inc. product ("Company") that Company is bound by
     * the SugarCRM Inc. Master Subscription Agreement (“MSA”), which is viewable at:
     * http://www.sugarcrm.com/master-subscription-agreement
     *
     * If Company is not bound by the MSA, then by installing or using this file
     * you are agreeing unconditionally that Company will be bound by the MSA and
     * certifying that you have authority to bind Company accordingly.
     *
     * Copyright (C) 2004-2014 SugarCRM Inc.  All rights reserved.
     ********************************************************************************/
    $popupMeta = array(
            'moduleMain' => 'User',
            'varName' => 'USER',
            'orderBy' => 'user_name',
            'whereClauses' => array(
                    'first_name' => 'users.first_name',
                    'last_name' => 'users.last_name',
                    'user_name' => 'users.user_name',
                    'is_group' => 'users.is_group',
            ),
            'whereStatement'=> "users.status != 'Reserved'  AND users.portal_only= '0'",
            'searchInputs' => array(
                    'first_name',
                    'last_name',
                    'user_name',
                    'is_group',
            ), );
    This code is modified from the stock file found here:
    ./modules/Users/metadata/popupdefs.php
    Within that file, the 'whereStatement' is "users.status = 'Actvie'  AND users.portal_only= '0'",  The modification above will return both Active and Inactive Users, but not Reserved type Users (the SNIP Email Archiving User).

    Once this file is in place, you'll need to perform a Quick Repair and Rebuild from Admin > Repair.  Then, when searching for Users in the #bwc modules Assigned To field, all Users, Active and Inactive.  You can select the Inactive User.

    If you have any questions, please let me know.

    Regards,

    Dan Kallish
    Technical Support Engineer
    SUGARCRM
  • Hi Dan,

    Im using Community Edition 6.5.0. I try to to implement the custom popupdef file but its not listing Inactive users. even i change the
    'whereStatement'=> "users.status != 'Reserved'
    to
    'whereStatement'=> "users.status = 'Inactive'

    Still im seeing the Active users only in Assigned To field in Cases. Also my need is to show the status of the user near the name of the user like below screen.

    Is there is possibility?

  • Hi Dan,

    I've tried to implement this approach on Sugar 7.5 without success. After digging a bit more i've found this clause on the jssource file:

    .../jssource/src_files/include/javascript/sugar7/plugins/QuickSearchFilter.js

    // See MAR-1362 for details.

    if (searchModule === 'Users' || searchModule === 'Employees') {

        returnFilter[0] = ({

            '$and': [

                {'status': {'$not_equals': 'Inactive'}},

                returnFilter[0]

            ]

        });

    }

    After commenting this code, the search started to return the inactive users, however:

    • since we were unable to find information about the "MAR-1362" mencioned, we're not sure if we can perform a customization of the QuickSearchFilter.
    • To customize the QuickSearchFilter, should we reimplement the js code under .../custom/include/javascript/sugar7/plugins/QuickSearchFilter.js ?