Author - StudySection Post Views - 8,870 views
Apex

Sending Wrapper object to Apex From LWC

We can pass a wrapper object directly to the apex without having to serialize or deserialize it through LWC as an apex parameter. Let’s take an example of the wrapper class or DTO (Data Transfer Object) class shown below in the apex.

apex-code

This object is used in the apex class to retrieve data from the LWC, which is passed as an object parameter from the LWC Apex class. This object is used to insert data into the Account and Contact objects.

apex-code1

To pass this AccountWrapper wrapper object to Apex and utilize it, we need to use JSON data as a method argument in LWC. This would behave as the normal parameter that we usually send to the Apex class from LWC. In LWC, we need to use import to reference any apex method before using it.

apex-code2

This is the method by which we can utilise a wrapper object in the Apex class, which is sent from LWC to Apex directly.

People having good knowledge of Financial accounting can get an Accounting Certification Exams from StudySection to increase their chances of getting a job in this field. You can get a foundation level certification if you are new to Financial accounting or you can go for advanced level certification if you have expert level skills in Financial accounting.

Leave a Reply

Your email address will not be published. Required fields are marked *

fiteesports.com rivierarw.com cratosroyalbet betwoon grandpashabet grandpashabet giriş deneme bonusu veren siteler casino siteleri