Created
October 22, 2012 00:33
-
-
Save forcementor/3929080 to your computer and use it in GitHub Desktop.
Developing Mobile…Force.com and Sencha-Part 3, Step 2: Lookback at Query() on Apex controller
This file contains 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
@RemoteAction | |
public static Response Query(QueryRequest qr) { | |
Response resp = new Response(); | |
List < Lead > LeadList; | |
filterString = qr.searchFilter; | |
try { | |
//Fetch all Leads for the user | |
LeadList = getAllLeads(); | |
} catch (Exception e) { | |
resp.success = false; | |
resp.errorMessage = 'Query failed: ' + e.getMessage(); | |
return resp; | |
} | |
//Supply only the requested records | |
for (Integer recno = qr.start; recno < (qr.start + qr.recordCount) && recno < LeadList.size(); ++recno) { | |
resp.records.add(LeadList[recno]); | |
} | |
resp.total = LeadList.size(); | |
resp.success = true; | |
return resp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment