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.

  • Do you only want to disable the duplicate check only on Name field OR remove the complete duplicate check functionality on record creation?
  • We only require it to be disabled on the name field

  • 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.

  • Hello seandonnelly

    You can achieve it by Extending vardefs.

    in main vardef search for  duplicate_check array.

    You need to remove name fields from filter_template array. 

    Make sure these changes you are doing by extending vardefs So it will be upgrade-safe.

    Do quick-repair & Rebuild.



    Hope it helps you

    Thanks



  • haha,I just do this in Opportunity Module tomorrow.Let me share my experience.

    1.Create \custom\Extension\modules\Opportunities\Ext\Vardefs\sugarfield_cancel_duplicate_check.php (The name of this file can be changed to else as you wish). And add the following code.

    <?php
    $dictionary['Opportunity']['duplicate_check']['enabled']=false;
     ?>

    2.Do quick-repair & Rebuild.

    That's all the things need to do.

    HTH





  • haalvin

    Thanks for sharing this.

    It will disable duplicate check for all fields.


  • Oh,thank you,I'll check this.
  • Much better than my approach. Thanks for this!