• Renan Freitas 5
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi everyone, I have a situation in which I do a case insert where in this situation the case is account child is only can insert once as I do to insert only once this case because when I execute the method it inserts more at once follow the code
@AURAEnabled
    public static void openNewCasepoliticament(Account contaPessoal){
        try{
            Case caso = new Case();
            //caso.Description = description;
            caso.Origin = 'Plataforma de investimentos';
            caso.Reason  = 'Problema de Cadastro';
            caso.Priority = 'Alta';
            caso.Status = 'Novo';
            caso.Type = 'Problemas de Cadastro';
            caso.SubTipo__c = 'Politicamente Exposto';
            caso.AccountId = contaPessoal.Id;
            insert caso;
            
            
            
        }catch(DMLException dml){
            System.debug('Falha ao inserir caso: ' + dml.getMessage());
            throw new AuraHandledException('Falha ao inserir caso: ' + dml.getMessage());
        }
    }