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
OviOvi 

Can a Managed Package contain Scheduled Apex jobs?

Hi,
I am planning to create a Managed package which integrates to another system trough web services.

When you install, or after installation, the package should fetch records from the external system. Thereafter the records should be upserted once a day.

I would like to know if :
1) A managed package can contain Apex scheduled jobs?
2) Can the package execute code on/after installation?
3) If 2. is not possible. Can user be displayed a VF page after installation which lets the user execute some script trough a button?

Best Answer chosen by Admin (Salesforce Developers) 
Sean TanSean Tan

You can have an Apex class in your managed package implement the InstallHandler interface, that will be called after the install of the managed package. In that class you can than schedule your job and execute the batch job to run for the first time.

 

See here for more details about the InstallHandler interface:

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_install_handler.htm