+ Start a Discussion
Harsha S 2Harsha S 2 

VF Page popup for some users when they login

Somehow I'm not getting replies in my existing post

https://developer.salesforce.com/forums/ForumsMain?id=906F0000000Ao3fIAC

I need to create a popup whenever user logs in and he has some records....i have created one VF page and kept it in home page component...and enabled...i'm not getting popup now....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>

can someone tell me what is going wrong here?...do i need to call from some controller ? ...

Can someone give some idea how to approach for this quickly?....pleaseeee

Gaurav NirwalGaurav Nirwal
After making all the changes and clicking the save button you add

 

<apex:CommandButton action="{!Save}"  onClick="popupWindow();" value="Save" />

 

Write the Script in the visual force

 

<apex:page>

<apex:form>

<script>

popup(){

Window.open('/VFPage Name');

}

ok(){

Window.close();

}

</script>

 

<apex:CommandButton action="{!Save}"  onClick="popupWindow();" value="Save" />

<apex:CommandButton action="{!ok}"  onClick="popupWindow();" value="ok" /> // This and the script for ok to be on the popup page.

</apex:form>

</apex:page> 
Harsha S 2Harsha S 2
Thanks for the reply Mathews...

Actually, I need to open popup when user logs in ....which is the event which triggers the popup...

in your example, user needs to click on Save button to get popup...

any idead about how we will achieve when user logs in ?