+ Start a Discussion
punnoosepunnoose 

How do i check on on load of a page

i have sitation like this when i load a page.based on a condition like if the login email address is say a predefined value

it should go to two diffrent pages . How do i do this

Thanks in advance

Punnoose

Best Answer chosen by Admin (Salesforce Developers) 
rohitsfdcrohitsfdc

Hi,

You can use action attribute of <apex:page> to write a logic to check. and then redirect the page according to the logic.

 

Example

<apex:page action="{!doAction}" />

controller: 

public pagereference doaction(){
   if(check logic)
     return new pagereference('\page1');
else
     return new pagereference('\page2');
}

 Hope this helps you

All Answers

rohitsfdcrohitsfdc

Hi,

You can use action attribute of <apex:page> to write a logic to check. and then redirect the page according to the logic.

 

Example

<apex:page action="{!doAction}" />

controller: 

public pagereference doaction(){
   if(check logic)
     return new pagereference('\page1');
else
     return new pagereference('\page2');
}

 Hope this helps you

This was selected as the best answer
Abhay AroraAbhay Arora

You can also have a homepage component and in that have a javascript to check the condition for you and redirect user based on your condition