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
Abi V 4Abi V 4 

How to Reload the URL onclick of the button salesforce

Onclick of the commnad link i need to refresh the viasulforce page(overrriden to vf  tab) URL .
Please suggest me how to acheive this.
Keyur  ModiKeyur Modi

Hi Abi, 

If you want to redirect page through custom controler then you can do it with help of PageReference. for more detail you can follow this blog  (

<apex:commandLink action="{!doRedirect}" value="Save" id="theCommandLink"/>


Public Class Controler1 {

Public pageReference doRedirect(){
      PageReference opportunityPage;
       //add your logic
      opportunityPage = new PageReference('/' +; // here I am redirecting this one to opportuntiy detail page.
return pageRefrence;


If you want to achieve that through javascript then you can try with below snippet of code :- 

    function toRedirect() {
<apex:commandLink  value="Save" id="theCommandLink" onClick=''toRedirect();"/>


Please let me know if you need more informaiton on this.

Keyur Modi