Skip to content

Instantly share code, notes, and snippets.

@choudharymanish8585
Created June 27, 2018 23:05
Show Gist options
  • Save choudharymanish8585/da6d066cd113e984db6095ea880ba38c to your computer and use it in GitHub Desktop.
Save choudharymanish8585/da6d066cd113e984db6095ea880ba38c to your computer and use it in GitHub Desktop.
public class AccountController {
@AuraEnabled
public static List<Account> getAccountsWithOffset(String pageSize, String pageNumber){
Integer ps = Integer.valueOf(pageSize);
Integer pn = Integer.valueOf(pageNumber)-1;
List<Account> accounts = [SELECT
Id, Name, Phone, Rating, My_Custom_Field__c, Active__c
FROM Account LIMIT :Integer.valueOf(ps) OFFSET :(ps*pn)];
return accounts;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment