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
PrasadVRPrasadVR 

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}"
rendered="{!Not(Display)}"/>
  </center>

 

 

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

 

 

avijchakavijchak

write this on the page action

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

</apex:page>

 

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

 

mark it helpful if it helps

 

@avijit Capgemini Developer

PrasadVRPrasadVR

how to call action function on window load.

avijchakavijchak

 

   <apex:form>

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

  </apex:form>

 

<apex:outputPanel rendered="{redirectRequired}" id="redirectPanel">
    <script>                
           redirectToAccount();
    </script>
  </apex:outputPanel>

 

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