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
BellaBella 

Pop Up Window through Scheduled Class

Hi. Does anyone know if there's any way to pop up a visual force page through a schedualed class? For instance, I'd like a certain vf page to pop up every hour on the hour. I thought I'd do this through a scheduled class like this:

 

 

global void execute(SchedulableContext ctx) {
	callPage();
}
    
public PageReference callPage(){
	PageReference pageRef =  new PageReference('/apex/somepage');
	return pageRef;
}

 

The class runs without any errors but nothing happens. Does anyone know how to achive this? Thanks!

 

 

 

 

TrueCloudTrueCloud

You need to do this using VF page and some Javascripting. I don't think you need to write a scheduled class for the same as the scheduled class will only run if the time is matched when the page is refreshed and the boolean is true.

 

First I need to know if you are going to embed this custom VF page on the navigation or is it going to run only when a user is on a specific page?

 

Please let me know if you need more help. I can write a sample code for you to take it on.

 

BellaBella

This page is supposed to pop up on the hour if the person is loged into salesforce (obviously). Actually it pops up conditionally (when a selected list of acrivities is not empty), but that's a minor point. The reason why I'm using the scheduled class is because I can run it every hour, but if there's a different way to schedual it, I'm totally open.

TrueCloudTrueCloud

Here is my thought how this can be done.

 

<apex:Page>

<script type ="text/javascript>

var timeinmillisecs = 360000;

if (Logic = true) {

setTimeout("window.open("http://www.mywebpage.com")",timeinmillisecs);

}

</script>






</apex:Page>

 

 

 

This may be a lot simpler that writing the schduled class to be call. the only caveat here is going to be to manage the timer function.

 

Also, I would warn you that there may be typos in this code. Please let me know if this works for you.

BellaBella

Sadly no, and I don't think it will. The problem is that I don't have any actual user input when calling the page since it's called from a scheduled class. Apparently it can't be done like that. Oh well, back to the drawing board. Thanks anyway!