Successfully reported this slideshow.

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

0

Share

1 of 11
1 of 11

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

0

Share

Download to read offline

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.

More Related Content

More from CzechDreamin

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

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

×