+ Start a Discussion

Controller for standard page


I have a custom page which contain some input fields for search criteria. After user enters search criteria, a list of leads are displayed which matches that criteria. If the user clicks one of those leads in list it will take him to a lead record in detail page mode i.e lead standard page. But I want to go back to search page with all the search criteria to be retained. How can I achieve this? If by clicking the list if  I go to a custom page I can create back link or back button on that custom page which can take me to that page with all the search criteria retained with the help of a custom controller. How can I achieve the same functionality with standard lead page.


Thanks in advance. 

Chamil MadusankaChamil Madusanka



I assume that you are using a dataTable or pageBlockTable for view the results. Then you can use <apex:outputLink> for your search result list (In a column).



apex:outputLink value="/{!id}" target="_blank">Detail</apex:outputLink>

 Try to get the Lead id to highlighted id. Then the Lead detail page will show up as a pop up with new window. So your result page will stay with your searching criteria.


If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.




Shashikant SharmaShashikant Sharma

For returning back to search page is easy you can just use parameter retUrl like ,


in query string but to retain the serach criteria is tricky for that you have to create a custom object where you will save that criteria, create a unique key for that criteria. When ever any user goes to detail page save that criteria and reatian that criteria when he comes back. To delete criteria garbage record run a daily or weekly shedulable class.


Assuming your query is a simple string, you should be able to include that in the returl parameter, in a suitably encoded form.  Then in your custom page, you'd have a page level action that interrogates the URL and if the query parameter is present, executes the query and pre-populates the search.