0

I have a question regarding the operation of the wrappers classes in lwc.

I have an apex method which has as an input parameter an object of the wrapper class.

FIRST IMAGE: enter image description here

SECOND IMAGE: enter image description here

The problem is that I don't know how to send a wrapper object of type "camposFormularioWrapper" from javascript to Apex. In Aura component it is easy, you create an attribute of type "camposFormularioWrapper" such that: enter image description here

Thank you.

1

You simply use a generic object. For example:

export default class myComponent extends LightningElement {
  @track someData = {tipoConfiguracion: 'some value', modificacionesElegidas: ['value 1','value 2']}

  // some time later //
  someFunction() {
    validaciones({camposFormulario: this.someData })
    .then(result => { /* handle result */ })
    .catch(error => { /* handle error */ });
  }
}

You simply need to remember that JavaScript is cAsE-sEnSiTiVe, so you can't misspelll the variable names or use a different capitalization than they are written in the Apex code.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.