Activity Forums Salesforce® Discussions What is Wrapper Class & Where to use Wrapper Class in Salesforce?

  • Manpreet

    Member
    April 19, 2017 at 1:20 pm

    Hi suraj,

    A wrapper or container class in Salesforce is a class, a data structure, or an abstract data type whose instances are collections of other objects.

    Let me give you a scenario, say you have to create a Table in your Visualforce Page. Each row of the table is suppose to show information from a Contact record also some details from the related Account record too. So, it would be nice, it we had a Class (An Abstract Data Type or a wrapper or a kind of a temporary holder for information) where it could hold the details for each row from different tables.

    Just try out a basic Wrapper http://www.infallibletechie.com/2015/03/sample-wrapper-class-using-apex-in.html

    Thanks.

  • shariq

    Member
    September 19, 2018 at 1:11 pm

    Hi,

    A wrapper or container class is a class, data structure, or an abstract data type whose instances are a collections of other objects.It is a custom object defined by Salesforce developer where he defines the properties of the wrapper class. Within Apex & Visualforce this can be extremely helpful to achieve many business scenarios within the Salesforce CRM software.

    Use of Wrapper Class within Salesforce:

    Many times in the community boards, people have asked the questions on how they can display a table of records with a check box and then process only the records that are selected. You can do it using this below step by step instructions. You can use wrapper class to display records from multiple records within a single table based around the business needs.

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos