[SalesForce] Redirecting from Controller to standard list view page

I'm using a custom_object and once the user save I want that page to redirect to list view page but what is happening is that right after i click save button i see the white blank screen with the following URL


Here is the code I have used:

I have tried this code:

Schema.DescribeSObjectResult anySObjectSchema = Employee__c.SObjectType.getDescribe();
String objectIdPrefix = anySObjectSchema.getKeyPrefix();
PageReference pageReference = new PageReference('/'+objectIdPrefix+'/o');
return pageReference;

and this code: (hard code the prefix) still does not work:

PageReference pageRef = new PageReference('/a00/o'); 
return pageRef;  

Best Answer

you could use inside your command button or link oncomplete="window.open('/a00', '_blank', height=400,location=no,resizable=yes,toolbar=no,status=no,me‌​nubar=no,scrollbars=‌​1', 1);"

OR Using a commandlink because you can set the target

`   public PageReference ReturnToList(){
    //do something here or no
    return new PageReference('/' + Employee__c.sObjectType.getDescribe().getKeyPrefix());
Related Topic