0

I need to get records based on recordtypeid and listviewid but it is returning all records. I don't know where I'm doing it wrong.(it will return records based on listview but recordtypeid condition is not applying).

String strquery = 'SELECT Id, Type,Status,Contact.Name,Origin FROM Case WHERE recordtypeID =: rtId LIMIT 500';
List<SObject> record  = queryRecords(Database.getQueryLocator(queryString), listViewID);

private static List<SObject> queryRecords(Database.QueryLocator sobjRecords, String ListId){
    try{
    ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(sobjRecords);
    ssc.setFilterID(ListId);
    ssc.setPageSize(200);
    return ssc.getRecords();
    }catch(Exception e){
        throw new AuraHandledException( e.getMessage() );
    }
}

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.