Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dangt85/d8c4e6c33cee0e35aa5a to your computer and use it in GitHub Desktop.
Save dangt85/d8c4e6c33cee0e35aa5a to your computer and use it in GitHub Desktop.
Custom List Controller class
/**
@Author <Author Name>
@name @@NAME@@
@CreateDate <dd/mm/yyyy>
@Description <purpose of the class>
@Version <1.0>
@reference <Referenced program names>
*/
public with sharing class @@NAME@@ {
// ApexPages.StandardSetController must be instantiated
// for standard list controllers
public ApexPages.StandardSetController setCtrl {
get {
if(setCtrl == null) {
setCtrl = new ApexPages.StandardSetController(Database.getQueryLocator(
[SELECT Name, CloseDate FROM Opportunity]));
}
return setCtrl;
}
set;
}
// Initialize setCon and return a list of records
public Opportunity[] getOpportunities() {
return (Opportunity[]) setCtrl.getRecords();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment