Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

What is Wrapper Class and How to use it with LWC, Oleh Mykytyn

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Wird geladen in …3
×

Hier ansehen

1 von 11 Anzeige

What is Wrapper Class and How to use it with LWC, Oleh Mykytyn

Herunterladen, um offline zu lesen

At some point in time, each salesforce developer meets with the Wrapper class as it gives some extra flexibility to us. You’ve probably already worked with it in Aura Component or Visualforce but what about Lighting Web Component? Do we have such a possibility there and if yes, how can we use wrappers there, and easily connect it with Apex.

At some point in time, each salesforce developer meets with the Wrapper class as it gives some extra flexibility to us. You’ve probably already worked with it in Aura Component or Visualforce but what about Lighting Web Component? Do we have such a possibility there and if yes, how can we use wrappers there, and easily connect it with Apex.

Anzeige
Anzeige

Weitere Verwandte Inhalte

Ähnlich wie What is Wrapper Class and How to use it with LWC, Oleh Mykytyn (20)

Weitere von CzechDreamin (20)

Anzeige

Aktuellste (20)

What is Wrapper Class and How to use it with LWC, Oleh Mykytyn

  1. 1. What is Wrapper Class and How to use it with LWC by Oleh Mykytyn
  2. 2. #CD22 Introduction Oleh Mykytyn 10x Certified Lviv's Salesforce Developer Group Leader Lviv's Salesforce Saturday Founder Salesforce MVP class 20/21 Salesforce Tech Lead & Strategic Relationship Director at Redtag Email: oleh.mykytyn@redtag.pro Twitter: @oleh_mykytyn
  3. 3. #CD22 Today’s Agenda 1. What is Wrapper Class 2. Benefits of Wrapper Class 3. Wrapper Class Use Cases in LWC 4. Best Practices 5. Demo 6. Q & A
  4. 4. #CD22 Salesforce Stands With Ukraine As the war in Ukraine persists with its heartbreaking impact on the courageous Ukrainian people and their loved ones around the world, we’re continuing our support of humanitarian efforts in the region. Together with our employees we’ve now donated more than $4 million USD to address basic needs, support refugees, and advance food security across Ukraine. We’re encouraging our employees to continue to donate to our trusted nonprofit partners and Salesforce will continue to match those donations.
  5. 5. #CD22 What is Wrapper Class? A wrapper class is a data structure, or an abstract data type which can contain different objects or collections of objects as its members. Wrapper class is similar to a custom object but it is an class created in Apex and whose instances could be different data type like primitive, collections or sObjects.
  6. 6. #CD22 Benefits Of Wrapper Class in Salesforce ● Consolidate a set of different data from multiple Objects ● Helps to combine different types of appropriate data and organize it efficiently ● Good approach for code reusability ● Can be used in Lightning Web Component, AURA, Visualforce and Apex ● Possibility to convert the JSON string into object and vice versa ● Multiple wrapper and nested classes can be used in a single Class
  7. 7. #CD22 Wrapper Class Use Case in LWC ● Display a table of records which contains combined data from several objects in one row, for example Order Item and Product Warranty. ● To show data received from another system via REST API. Without same data model in Salesforce we can easy convert JSON into Wrapper and display it for user. ● Display a list of records with checkbox and possibility to select multiple records and to do some actions with them. And for this checkbox we don’t need to save data in object.
  8. 8. #CD22 Wrapper Class Best Practices ● Using Wrapper Class is a best practice ● Create a separate Apex Class for your Wrapper Class ● Keep inner nested Wrapper Class at the end of your Apex Class ● Use all Object-oriented principles that allow to accomplish code reusability ● Always try to keep it as much unified as possible ● Keep it clean and good structured which will help understand it’s usage
  9. 9. #CD22 Demo Time! Wrapper Class in Action
  10. 10. #CD22
  11. 11. Thank you! #CD22

×