0

I have a problem which I think could be an LWC bug. enter image description here I need to pass an object, in this case a contract, which I get from @wire getRecord: enter image description here enter image description here

enter image description here have seen that there is a similar thread, which reports that @wire getRecord obtains the object in a format which is not compatible with the apex object format. In this thread they exposed the solution, but honestly it has not worked for me, es esta funcion: enter image description here

Thank you.

EDIT:

validarContratoJS(){
console.log('contrato: '+JSON.stringify(this.contract));
this.contract = this.getSObject(this.contract);
console.log('contrato2: '+JSON.stringify(this.contract));
this.camposFormularioWrapper = { tipoConfiguracion : 'validarContrato', contrato : this.contract };
console.log('camposFormularioWrapper: '+JSON.stringify(this.camposFormularioWrapper));
validarContrato({camposFormulario: this.camposFormularioWrapper })
    .then(result => { 
        if(!result.success){
            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);
});
  • 1
    can you add the code where you are getting this error, also Its recommended to post the code instead of the screenshot of the code. – rahul gawale Jan 16 at 11:08
  • Good, I have already updated the post with the function. Surprisingly it already works for me and I don't know why, yesterday I was throwing the error I mentioned earlier. Thanks for answering – Diego Lucas Romero Jan 16 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.