How can I disable the duplication check on the Name field?

Hi

Whenever I save a new record for any module it runs a record duplication validation and shows a list of all other records with the same name as the on I'm trying to save and it prompts me to either cancel the saving or to Ignore Duplicate and Save.

Anyway I can disable this validation? The validation is happening on the "Name" field.

I am using SugarCRM Professional, Version 7.2.0, on demand.

Any help will be appreciated.

Parents
  • In my case I didn't want the duplication check to happen for a certain module. 
    I just had to override the "checkForDuplicates" function with an empty array. 

    Like this: 

    1. create this file: custom/modules/<your module>/clients/base/api/CustomDuplicateCheckApi.php:
    <?php
    // /*
    //    WE DO NOT WANT TO CHECK FOR DUPLICATES!!!
    // */
    require_once('include/api/SugarApi.php');
    class CustomDuplicateCheckApi extends SugarApi
    {
        public function registerApiRest()
        {
            return array(
                'duplicateCheck' => array(
                    'reqType' => 'POST',
                    'path' => array('<module>','duplicateCheck'),
                    'pathVars' => array('module',''),
                    'method' => 'checkForDuplicates',
                    'shortHelp' => 'Check for duplicate records within a module',
                    'longHelp' => 'include/api/help/module_duplicatecheck_post_help.html',
                ),
            );
        }
        function checkForDuplicates(ServiceBase $api, array $args)
        {
            return array();
        }
        protected function handleEmptyBean($bean)
        {
            if (empty($bean)) {
                throw new SugarApiExceptionInvalidParameter('Unable to run duplicate check. Bean was empty after attempting to populate from API');
            }
        }
        protected function trimArgs($args)
        {
            $args2 = array();
            foreach($args as $key => $value) {
                $args2[trim($key)] = (is_string($value)) ? trim($value) : $value;
            }
            return $args2;
        }
        protected function populateFromApi($api, $bean, $args, $options=array())
        {
            return ApiHelper::getHelper($api,$bean)->populateFromApi($bean,$args,$options);
        }
    }
    2. Do a quick-repair & rebuild. 
    3. PROFIT.

Reply
  • In my case I didn't want the duplication check to happen for a certain module. 
    I just had to override the "checkForDuplicates" function with an empty array. 

    Like this: 

    1. create this file: custom/modules/<your module>/clients/base/api/CustomDuplicateCheckApi.php:
    <?php
    // /*
    //    WE DO NOT WANT TO CHECK FOR DUPLICATES!!!
    // */
    require_once('include/api/SugarApi.php');
    class CustomDuplicateCheckApi extends SugarApi
    {
        public function registerApiRest()
        {
            return array(
                'duplicateCheck' => array(
                    'reqType' => 'POST',
                    'path' => array('<module>','duplicateCheck'),
                    'pathVars' => array('module',''),
                    'method' => 'checkForDuplicates',
                    'shortHelp' => 'Check for duplicate records within a module',
                    'longHelp' => 'include/api/help/module_duplicatecheck_post_help.html',
                ),
            );
        }
        function checkForDuplicates(ServiceBase $api, array $args)
        {
            return array();
        }
        protected function handleEmptyBean($bean)
        {
            if (empty($bean)) {
                throw new SugarApiExceptionInvalidParameter('Unable to run duplicate check. Bean was empty after attempting to populate from API');
            }
        }
        protected function trimArgs($args)
        {
            $args2 = array();
            foreach($args as $key => $value) {
                $args2[trim($key)] = (is_string($value)) ? trim($value) : $value;
            }
            return $args2;
        }
        protected function populateFromApi($api, $bean, $args, $options=array())
        {
            return ApiHelper::getHelper($api,$bean)->populateFromApi($bean,$args,$options);
        }
    }
    2. Do a quick-repair & rebuild. 
    3. PROFIT.

Children
No Data