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
LVSLVS 

Redirect user to VF page on login

For all users of a particular profile, when they login they should be taken to a visualforce page instead of the standard home page. I can differentiate the user based on profile in the controller if I'm able to redirect ALL users to the visualforce page.

 

Any ideas?

 

Thanks in advance.

 

~LVS

Best Answer chosen by Admin (Salesforce Developers) 
Dipa87Dipa87

I did something like this. I used a homepage component to redirect. I was checking if it in iPad it will redirect to custom VF page instead of standard one.

May be you can get some idea from this.

Create a home page component and write a similar logic there:

<script type="text/javascript">
        function addLoadEvent(func) {  
            var oldonload = window.onload;       
            if (typeof window.onload != 'function') {   
                window.onload = func;                    
            }                               
            else {                 
                window.onload = function() {     
                if (oldonload) {                  
                    oldonload();                    
                }                             
                    func();                      
                }                            
            }               
        }         
        addLoadEvent(function() {         
            GoToPage();             
        });           
        </script>
        <!--------/Wait for the loading of the page--------->
        <script type="text/javascript">         
        function GoToPage() {        
            window.location= '/apex/pageName';              
        }              
        </script>