Activity Forums Salesforce® Discussions What is a wrapper class? Give one use case where you would use a wrapper class in Salesforce?

  • Nikita

    Member
    November 29, 2019 at 6:33 am

    Hi,

    Wrapper Class in Apex Salesforce: 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 a 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 that has different data types or properties as per requirement. We can wrap different object 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 checkbox and then process only the records that are selected. In this example, we are displaying list of accounts with checkbox. End user can select account and then click on the Show Selected accounts button. Then selected account will be displayed in table.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos