Created
October 22, 2012 00:43
-
-
Save forcementor/3929109 to your computer and use it in GitHub Desktop.
Developing Mobile…Force.com and Sencha-Part 3, Step 2: Refactored Query() on Apex controller
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
| @RemoteAction | |
| public static Response Query(QueryRequest qr) { | |
| Response resp = new Response(); | |
| //Enforce a limit on the number of rows requested. | |
| final integer QUERY_LIMIT = 500; | |
| if (qr.start >= QUERY_LIMIT) { | |
| resp.success = false; | |
| resp.errorMessage = 'Maximum number of records (' + String.valueOf(QUERY_LIMIT) + ') exceeded!'; | |
| return resp; | |
| } | |
| try { | |
| getAllLeads(qr, resp); | |
| } catch (Exception e) { | |
| resp.success = false; | |
| resp.errorMessage = 'Query failed: ' + e.getMessage(); | |
| } | |
| return resp; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment