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

Would like to redirect user auotmaticalley into next page

HI ,


Can anyone help me out how to redirect user automatically into some other page ,when i click on redirect to account link.pageReference method will call and it will take me into account page , but i want to perform this action automatically.

Below is the my code.


<apex:commandLink value="Redirect to Account" style="color:blue; font-weight:bold;" action="{!RedirecttoAccount}"



public PageReference RedirecttoAccount() {
     PageReference Page = new ApexPages.StandardController(acc).view();
     Return Page; }




write this on the page action

<apex:page action="{!redirect}">



or you can run or call action function on window.onload


mark it helpful if it helps


@avijit Capgemini Developer


how to call action function on window load.




       <apex:actionFunction name="redirectToAccount" action="{!redirect}" />



<apex:outputPanel rendered="{redirectRequired}" id="redirectPanel">


I have puted one extra variavle to redirect based in condition i.e when redirectRequired is true if you want it all the time then no need of rendered. If you want it all the time better to write in page action