1

I would like to know how to obtain the data that my apex method is generating step by step, system debugs. I have not seen any documentation on the internet which has some information of what I need.

In aura it's easy, you open the developer console and you get all the apexlogs in the "log section".

I only found examples for javascript on the internet and not for apex

Thank you.

EDIT:

validarContratoJS(){

this.contract = this.getSObject(this.contract);
this.camposFormularioWrapper = { tipoConfiguracion : 'validarContrato', contrato : this.contract };

validarContrato({camposFormulario: this.camposFormularioWrapper })
    .then(result => { 
        if(!result.success){
            console.log('error: '+ JSON.stringify(result));
            this.contratoValido = true;
            this.contratoCortable = result.contratoCortable;
            console.log('codigo tipo contrato: '+this.contract.ATN_Codigo_Tipo_Contrato__c);
            this.codTipoContrato = this.contract.contratoCortableATN_Codigo_Tipo_Contrato__c;

        if(this.contratoValido && result.fechaVencimientoProducto){
            this.fechaVencimientoProducto = true;
        }
        if(this.contratoValido && result.solicitudModificado){
            this.solicitudModificado = true;
            //falta poner disabled boton modificacion economica
            //falta poner disabled boton tecnicas siempre que la linea negocio sea distinto de Gas
        }
        this.spinner = false;
        console.log('he puesto el spinner a false');
    }else{
        this.spinner = false;
        this.mensajeError = result.mensaje;
        this.contratoValido = false;
        console.log('mensajeError pero bien: '+this.mensajeError);
    }
})
.catch(error => { 
  console.log('Error mensaje: '+JSON.stringify(error));
  let message = 'Unknown error';
        if (Array.isArray(error.body)) {
            message = error.body.map(e => e.message).join(', ');
        } else if (typeof error.body.message === 'string') {
            message = error.body.message;
        }
        console.log('Error mensaje detallado: '+message);
});}

This javascript function calls the apex method "validarContrato", but the console does not throw any debug log to know why it has returned the value in one way or another.

7
  • 1
    I certainly wish to help you but I am not sure what you are asking. Can I suggest a little code examples of your LWC and/or Apex Class. Every custom apex call creates a log that you can find in salesforce dev console. Jan 16, 2020 at 12:19
  • It goes under aura logs in developer console. Jan 16, 2020 at 12:22
  • LWC does not create any debug logging in the developer console. I am currently migrating an aura component to LWC. the component the first thing it does is validate the contract record. I update the post with the code Jan 16, 2020 at 12:32
  • LWC does not create debug logging as it's a web component framework for salesforce platform (front end) You need to debug using chrome or browser supported debug tool like debugging client side JS.
    – Mitesh
    Jan 16, 2020 at 13:00
  • the aura component gives me a result and LWC another with the same data and the same method. Do you mean that with LWC I cannot obtain for example system debugs or any debug log ?, It doesn't make sense yet to migrate to web component then. Jan 16, 2020 at 13:19

0

You must log in to answer this question.

Browse other questions tagged .