Activity Forums Salesforce® Discussions What are wrapper classes in Salesforce?

  • Shubham

    Member
    July 26, 2017 at 11:34 am

    Hi Shariq

    A wrapper or container class is a class, a data structure, or an abstract data type which contains different objects or collection of objects as its members.
    A wrapper class is a custom object defined by programmer wherein he defines the wrapper class properties. Consider a custom object in salesforce, what do you have in it? fields right? different fields of different data types. Similarly wrapper class is a custom class which has different data types or properties as per requirement. We can wrap different objects types or any other types in a wrapper class.

    In the Visualforce most important use case is to display a table of records with a check box and then process only the records that are selected.

    In the example below, we are displaying list of accounts with checkbox. End user can select account and then click on Show Selected accounts button. Then selected account will be displayed in table.

    Click here for example

  • Parul

    Member
    September 16, 2018 at 12:23 pm

    A wrapper class is a custom object defined by programmer wherein he defines the wrapper class properties. Consider a custom object in salesforce, what do you have in it? fields right? different fields of different data types. Similarly wrapper class is a custom class which has different data types or properties as per requirement. We can wrap different objects types or any other types in a wrapper class.

     

     

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos