Skip to content

Instantly share code, notes, and snippets.

@forcementor
Created October 22, 2012 00:43
Show Gist options
  • Select an option

  • Save forcementor/3929109 to your computer and use it in GitHub Desktop.

Select an option

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
@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