Hi,
this checks if there is an email or a duplicate phone, both in the creation and in the modification.
Let me know if it works.
	
							
						
					this checks if there is an email or a duplicate phone, both in the creation and in the modification.
Let me know if it works.
PHP Code:
	
namespace Espo\Custom\Services;
use \Espo\ORM\Entity as Entity;
class Lead extends \Espo\Modules\Crm\Services\Lead
{
    protected $checkForDuplicatesInUpdate = true; // set true to enable for update
    protected function getDuplicateWhereClause(Entity $entity, $data)
    {
        return array(
                'OR' => array(
                    array(
                        'phoneNumber' => $entity->get('phoneNumber'),
                    ),
                    array(
                        'emailAddress' => $entity->get('emailAddress'),
                ),
            )
        );
    }
} 

Comment