Last active
August 29, 2015 14:16
-
-
Save charltonAthletic/b3bca5b4fc2b3a5408b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Custom controller for Visualforce Page - Example 1 | |
// Probably the nicest part of this controller is: 'AND OwnerId = :UserInfo.getUserId' | |
// which utilizes the getUserId method from the UserInfo class. More info here: salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_userinfo.htm | |
public class OpportunityRevisitDatesController { | |
public ApexPages.StandardSetController ssc { // allows us to create list controllers | |
get { | |
if(ssc == null) { | |
ssc = new ApexPages.StandardSetController(Database.getQueryLocator( // instantiate via a query locater | |
[SELECT Name, Account.Name, Revisit_Date__c FROM Opportunity WHERE Revisit_Date__c <= TODAY AND OwnerId = :UserInfo.getUserId()])); | |
} | |
return ssc; | |
} | |
set; | |
} | |
public List<Opportunity> getOpportunities() { // Method of List collection of sObject Opportunity called getOpportunities | |
return (List<Opportunity>) ssc.getRecords(); // return List of sObject results from ssc (Standard Set Controller) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment