2 answers

Hi Vaibhab,I have gone through your problem. To assign the dynamic query results in the accounts property of the AccountPagerWrapper.In my code myTestString is a string for applying condition in the database query. Please go through the code given below.public class WrapperClass { @AuraEnabledpublic static AccountPagerWrapper getData (Decimal pageNumber ,Integer recordToDisply) { Integer pageSize = recordToDisply; Integer offset = ((Integer)pageNumber - 1) * pageSize; String queryCount = 'SELECT count() FROM Account'; String myTestString = 'TestName'; List<Account> returnList = new List<Account>(); returnList = database.query('Select ID,Name from Account where Name= : myTestString'); AccountPagerWrapper obj = new AccountPagerWrapper(); obj.pageSize = pageSize; obj.page = (Integer) pageNumber; obj.total = database.countQuery(queryCount); obj.accounts = returnList; System.debug('obj.accounts --->'+obj.accounts ); return obj; }public class AccountPagerWrapper { @AuraEnabled public Integer pageSize {get;set;} @AuraEnabled public Integer page {get;set;} @AuraEnabled public Integer total {get;set;} @AuraEnabled public List<Account> accounts {get;set;} }}I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.Thanks and Regards,Deepali Kulshresthawww.kdeepali.com