function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Renan Freitas 5Renan Freitas 5 

Case insertion

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());
        }
    }
bretondevbretondev
Pleasse all of your code including calling Lightning Component
bretondevbretondev
copy*