Reader small image

You're reading from  Visualforce Development Cookbook

Product typeBook
Published inSep 2013
Reading LevelIntermediate
PublisherPackt
ISBN-139781782170808
Edition1st Edition
Languages
Right arrow
Author (1)
Keir Bowden
Keir Bowden
author image
Keir Bowden

Keir Bowden is a 30-year veteran of the IT industry from the United Kingdom. After spending the early part of his career in the defence industry, he moved into investment banking systems, implementing systems for Banque Nationale de Paris, CitiGroup, and Deutsche Bank. In the late 1990s, Keir moved into Internet technologies, leading to a development of the order management and payment handling systems of one of the first European Internet shopping sites. Keir started working with Force.com in late 2008 and has been recognized multiple times by Salesforce as an MVP for his contribution and leadership in the community. In 2012, he became the first certified technical architect outside of Salesforce in EMEA, and he has served as a judge on several EMEA Technical Architect Certification Review Boards. Keir is also a prominent blogger on Apex, Visualforce and Lightning Components solutions; and a regular speaker at events such as Dreamforce, Cloud World Forum, and Salesforce World Tour. Keir is a chief technical officer of BrightGena—a Salesforce.com Platinum Cloud Alliance Partner in the United Kingdom, where he is responsible for the present and future technical strategies. Keir acted as a technical reviewer for the CRM Admin Cookbook before accepting the challenge of authoring this book, which also happens to be his first.
Read more about Keir Bowden

Right arrow

Using wrapper classes


A common use case for Visualforce is to present a list of sObjects, allowing a user to select a number of these, and then choose an action to apply to the selected entries. Marking an sObject entry as selected presents a challenge, as it is associating transient information, the selected status, with a record persisted in the Salesforce database.

The solution is to use a wrapper class to encapsulate or wrap an sObject instance and some additional information associated with the sObject instance.

In this recipe, we will create a Visualforce page that presents a list of opportunity sObjects, and allows the user to select a number of records to remove from the displayed list.

Getting ready

This recipe makes use of a wrapper class which associates a checkbox with an opportunity sObject record.

  1. Navigate to the Apex Classes setup page by clicking on Your Name | Setup | Develop | Apex Classes.

  2. Click on the New button.

  3. Paste the contents of the SelectOpportunityWrapper.cls Apex class...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Visualforce Development Cookbook
Published in: Sep 2013Publisher: PacktISBN-13: 9781782170808

Author (1)

author image
Keir Bowden

Keir Bowden is a 30-year veteran of the IT industry from the United Kingdom. After spending the early part of his career in the defence industry, he moved into investment banking systems, implementing systems for Banque Nationale de Paris, CitiGroup, and Deutsche Bank. In the late 1990s, Keir moved into Internet technologies, leading to a development of the order management and payment handling systems of one of the first European Internet shopping sites. Keir started working with Force.com in late 2008 and has been recognized multiple times by Salesforce as an MVP for his contribution and leadership in the community. In 2012, he became the first certified technical architect outside of Salesforce in EMEA, and he has served as a judge on several EMEA Technical Architect Certification Review Boards. Keir is also a prominent blogger on Apex, Visualforce and Lightning Components solutions; and a regular speaker at events such as Dreamforce, Cloud World Forum, and Salesforce World Tour. Keir is a chief technical officer of BrightGena—a Salesforce.com Platinum Cloud Alliance Partner in the United Kingdom, where he is responsible for the present and future technical strategies. Keir acted as a technical reviewer for the CRM Admin Cookbook before accepting the challenge of authoring this book, which also happens to be his first.
Read more about Keir Bowden