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;  

1 Answer 1


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());
  • i do not like to use any javascript and i'm sure there is better way of doing than this.
    – Nick
    Commented Sep 23, 2016 at 2:10
  • Hi Nick, if you don't like js then the second option should do it. I hope it helps.
    – Carlos
    Commented Sep 23, 2016 at 20:35
  • Still have the same issue after I click save button, I see the blank white screen with the url I posted in my question
    – Nick
    Commented Sep 23, 2016 at 23:07
  • That's weird, those are two valid ways to accomplish what you need. I use these approaches all the time. I don't think you problem is in the code. I would check user permissions or page security. Good luck!
    – Carlos
    Commented Sep 26, 2016 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .