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
csbaacsbaa 

display VF page after login

Hello Helper

 

I want to force a logged user to do something  before start working .  for this I see 2 options:  

 

A. automatically redirect the user to a visual force page right after login

 

Or 

 

B. display a modal dialog box  on the home tab  like the salesforce "Getting started with Chatter"

 

It would be possible?

any other options/suggestion are welcomed

 

 

Thanks in advance

csbaa

Best Answer chosen by Admin (Salesforce Developers) 
izayizay

I had a similar requirement to redirect users to an agreement page the first time chatter was deployed. We needed to record that the user agreed to the terms of use and the date they agreed. To do this, I created a checkbox and a date field in the user object. Then, I created a vfpage and controller to verify if the user had agreed to the terms of use before redirecting them to the terms of use agreement page. After that I created a HomePage HTML component and added the vfpage to the component via iframe. The last thing was to make every user's landing tab the Home Tab. Here is a sample code for the page and controller and iframe.

 

Hope this helps!

 

<!-- VFPage -->
<apex:page controller="RedirectController" showHeader="false" sidebar="false">
    
  <script type="text/javascript" src="{!URLFOR($Resource.jQuery)}"></script>
    
   <script type="text/javascript">

        $j = jQuery.noConflict();
        //Set this code to run when the page is done loading
        $j(document).ready(function() {
            //Get the value of agreed from the controller
            var agr = "{!agreed}";
            //Set the action for the button
            $j("#Btn").click(function(){ 
                parent.location = "/apex/Agreement_VFPage";           
            });
            //If the user hasn't agreed with the terms of use
            if(agr == "false"){
                //Click the button which will redirect the user to the agreement page
                $j("#Btn").click();           
            }

        });
    </script>


    <input id="Btn" value="Btn" type="button" style="visibility:hidden"></input>
    
</apex:page>

/* Controller */
public with sharing class RedirectController{
    //Set variables
    public Boolean agreed{get;set;}
    private Date today = date.today();
    //Constructor
    public RedirectController(){
        setAgreed();
    }
    //Get the value from the current user's Chatter_Agreement__c field
    public void setAgreed(){
        agreed = [select Chatter_Agreement__c from User where id = :UserInfo.getUserId()].Chatter_Agreement__c;
    }
}

HTML Component
<iframe src="https://xxx.salesforce.com/apex/RedirectVFPage" />

 

All Answers

__

Setup > Customize > User Interface

Check [X] Show Custom Sidebar Components on All Pages

 

Create a new Home Page Component (HTML, narrow) add JS to redirect or popup whatever is needed.

AmitSahuAmitSahu
Go with option A. In your setup, where you can define the landing page of the app.Create a VFpage tab and land on the page. On the VF page and via JS prevent the user from going anywhere before the step you want is over.
izayizay

I had a similar requirement to redirect users to an agreement page the first time chatter was deployed. We needed to record that the user agreed to the terms of use and the date they agreed. To do this, I created a checkbox and a date field in the user object. Then, I created a vfpage and controller to verify if the user had agreed to the terms of use before redirecting them to the terms of use agreement page. After that I created a HomePage HTML component and added the vfpage to the component via iframe. The last thing was to make every user's landing tab the Home Tab. Here is a sample code for the page and controller and iframe.

 

Hope this helps!

 

<!-- VFPage -->
<apex:page controller="RedirectController" showHeader="false" sidebar="false">
    
  <script type="text/javascript" src="{!URLFOR($Resource.jQuery)}"></script>
    
   <script type="text/javascript">

        $j = jQuery.noConflict();
        //Set this code to run when the page is done loading
        $j(document).ready(function() {
            //Get the value of agreed from the controller
            var agr = "{!agreed}";
            //Set the action for the button
            $j("#Btn").click(function(){ 
                parent.location = "/apex/Agreement_VFPage";           
            });
            //If the user hasn't agreed with the terms of use
            if(agr == "false"){
                //Click the button which will redirect the user to the agreement page
                $j("#Btn").click();           
            }

        });
    </script>


    <input id="Btn" value="Btn" type="button" style="visibility:hidden"></input>
    
</apex:page>

/* Controller */
public with sharing class RedirectController{
    //Set variables
    public Boolean agreed{get;set;}
    private Date today = date.today();
    //Constructor
    public RedirectController(){
        setAgreed();
    }
    //Get the value from the current user's Chatter_Agreement__c field
    public void setAgreed(){
        agreed = [select Chatter_Agreement__c from User where id = :UserInfo.getUserId()].Chatter_Agreement__c;
    }
}

HTML Component
<iframe src="https://xxx.salesforce.com/apex/RedirectVFPage" />

 

This was selected as the best answer
csbaacsbaa

thanks  very much  

 

My requirement was also related to chatter

 

Regards

csaba

csbaacsbaa

Thank you for your answer

 

"Landig  page"  this was the key info I missed

 

 

Regards

csaba