AnsweredAssumed Answered

Check value duplication in lead convertion? Sugar 7.x

Question asked by Rodolfo Jesus on May 4, 2016

I'm need check field value of contact is duplication in database (lead Convertin).

 

- I'm select lead for convertion

- In Pool screen

- I need check field value of new contact

My code in before_sabe contacts, not work.

function before_save_method($bean, $event, $arguments) {


  global $db, $current_user;


  if($this->checkContaExistente($db, $bean) && !$this->checkExistente($db, $bean)){
  require_once 'include/api/SugarApiException.php';  
  throw new SugarApiExceptionInvalidParameter("Numero da conta corretora já existe gravado para outro cliente!");
  }
  else if($this->checkEdition($db, $bean) && $current_user->is_admin){
        require_once 'include/api/SugarApiException.php';  
  throw new SugarApiExceptionInvalidParameter("Apenas o administrador pode editar os campos nome, cpf, inst. financeira, conta corretora e dígito!"); 
  } 
        


  }

 

But, this code work if create a contact direct by contact module.

Outcomes