function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TerryLuschenTerryLuschen 

Redirecting back to List View after some a mass action.

I have the following sequence I would like to do...

 

1) I have created a custom List button for a custom object.

2) This button redirects the user to another Visualforce page with a custom controller.   It takes an action on some of the custom objects depending on a certain status. 

3) After the action is complete I would like to return to the page where the custom list button was clicked by creating an appropriate PageReference.

 

I looked at using the StandardController, StandardSetController and URLFor objects to try to create the correct PageReference object, but I have had not luck.

 

This should be so simple.   Really the questions boils down to 'How do I create a URL to the default View for a custom object?'  

 

Thanks!

Starz26Starz26

try

 

public String getReferer(){
   return ApexPages.currentPage().getHeaders().get('Referer');
}

rohitsfdcrohitsfdc

Try this way:

Copy the list view page address from address bar and return that address in button click on your vf page. for example

 

return new PageReference('https://ap1.salesforce.com/001/o'); 

TerryLuschenTerryLuschen

Thank you for the idea.   This seems to put my code in an endless loop.    The Referer is returning this

 

https://cs7.salesforce.com/servlet/servlet.Integration?scontrolCaching=1&lid=00bM0000000DhpW&eid=&ic=1 

 

The URL that I want looks like this:

 

https://cs7.salesforce.com/a1m?fcf=00BM0000000PYLK

 

But I don't want to hard-code a URL as the other post mentioned.  This needs to work in multiple sandboxes and in production.

 

Thanks!