+ Start a Discussion
Harsha S 2Harsha S 2 

How to show a popup as soon as user logs into salesforce, if he has some records from customobject on which he has to work on ?

Hi All,

This is urgent requirement!!

Can anyone help me to show a popup as soon as user logs into salesforce, if he has some records from customobject to work on?

So What I mean is , popup should dynamically refer the logged in user's records in custom object and if it meets some criteria then it should some message.

I referred other posts with VF page as popup in home page components. But what I got is all the VF pages needs some action to trigger (Like custom button) ...but here action is "User logs in" ..How to do that ?
RamuRamu (Salesforce Developers) 
The below post might help

https://developer.salesforce.com/forums/ForumsMain?id=906F00000008sq8IAA
Sumitkumar_ShingaviSumitkumar_Shingavi
1. You can either have a Custom Vf tab which has splash screen - (Not sure if this will work but my guess)
2. You can develop a Home page component and add VF inside it as iframe where user can take a go.
James LoghryJames Loghry
In Winter '15, they added a new feature called "Login Flow", which will fire a Visual Flow when the user logs into Salesforce.

In your case, you would create a Flow that checks the custom object through either a query or perhaps an Apex Flow plugin, then presents those records to the User through a Flow Screen.

Check out the following document for more information: http://releasenotes.docs.salesforce.com/en-us/api_cti/release-notes/rn_forcecom_security_login_flows.htm (http://releasenotes.docs.salesforce.com/en-us/api_cti/release-notes/rn_forcecom_security_login_flows.htm)
Harsha S 2Harsha S 2
@sumit...iFrame will take me to a page inside salesforce...can I get a popup ?
Harsha S 2Harsha S 2

@ramu...Have gone through the link which you have provided...Yes I know how to create a home page component with VF page..

But do you have any code which I can include in that VF page to open it as popup without having to click on any button in that VF page?

It should directly open as popup...

Sumitkumar_ShingaviSumitkumar_Shingavi
Popup is not feasible at this moment
Harsha S 2Harsha S 2
Finally I found something.

We need to create a VF page with below code and include this VF page in HomePage components under (VF page category) and then include this home page component in Home Page layouts.


<apex:page wizard="true" >
<script>window.onload=get; function get() {
alert('Mesaage to be displayed on popup'); url='/apex/user' ;
newwindow=window.open(url,'name','height=300,width=250');
}
</script>
</apex:page>


Though as per my requirement I need to show some custom object records as links....that is not possible with alert()...i'm looking out for window.open() or prompt()..
Will let you know once im done with it....
But i'm happy that i'm getting popup as of now...let me improve this now :)
Harsha S 2Harsha S 2
I'm stucked at some point...I want to show this popup only to users who has got some records....here is what i have done 


<apex:page wizard="true" >
 <script src="/soap/ajax/22.0/connection.js"></script>
<script src="/soap/ajax/22.0/apex.js"></script>
<script>
var queryresult = sforce.connection.query("Select Id from Position__c where Id != null");
var records = queryresult.getArray("records");
if(records != null && records.size()>0) {
window.onload= reconcile;
}
else {
window.onload = noReconcile;
}
function reconcile() {
alert('You have got POSITION RECORDS');
url='/apex/user' ;
newwindow=window.open(url,'name','height=300,width=250');
}
function noReconcile() {
alert('You have NO POSITION RECORDS');
url='/apex/user' ;
newwindow=window.open(url,'name','height=300,width=250');
}
</script>
</apex:page>

I'm not able to do get popup now..can someone tell me what is going wrong here ?