+ Start a Discussion
Alan MonkAlan Monk 

Run a scheduled job in visual force page

Hi Guys, I am new to Visual force development and need some help.

I have created a custom link on my home page to run a scheduled job immediately. I need to create a VF page to do this but need some help in creating the page text.

What I need to run is the following:

TelesalesDataProcessor runJob = new TelesalesDataProcessor();
runJob.execute(null);

Any help would be appreciated.

Thanks

Alan

 
Best Answer chosen by Alan Monk
Om PrakashOm Prakash
Hello Alan,
Sample code for your requirement is bellow:
public class TelesalesDataUtility{

   public void scheduleJob(){
     TelesalesDataProcessor runJob = new TelesalesDataProcessor();
     runJob.execute(null);
   }
}
 
<apex:page controller="TelesalesDataUtility">
  <apex:form>
      <apex:commandButton value ="Execute Job" action="{!scheduleJob}"/>
  </apex:form>
</apex:page>

 

All Answers

Om PrakashOm Prakash
Hello Alan,
Sample code for your requirement is bellow:
public class TelesalesDataUtility{

   public void scheduleJob(){
     TelesalesDataProcessor runJob = new TelesalesDataProcessor();
     runJob.execute(null);
   }
}
 
<apex:page controller="TelesalesDataUtility">
  <apex:form>
      <apex:commandButton value ="Execute Job" action="{!scheduleJob}"/>
  </apex:form>
</apex:page>

 
This was selected as the best answer
Alan MonkAlan Monk
Thank you for your help Om, much appreciated.
Om PrakashOm Prakash
Thanks Alan.