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
Jordan SmytheJordan Smythe 

Scheduled Jobs for AppExchange Apps

I am currently trying to develop and App for release on AppExchange but I cannot find any documentation on how to set up a scheduled job for once it's deployed. I am looking to create a job that runs everyday forever but don't know where to put the call or set up the call to do that when it is deployed as an App.

Thank you very much in advance for your answers,

J
Best Answer chosen by Jordan Smythe
Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that will help you
https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/packaging_uploading.htm

User-added image

https://developer.salesforce.com/docs/atlas.en-us.200.0.packagingGuide.meta/packagingGuide/apex_post_install_script.htm#apex_post_install_script

Running Apex on Package Install/Upgrade

App developers can specify an Apex script to run automatically after a subscriber installs or upgrades a managed package. This makes it possible to customize the package install or upgrade, based on details of the subscriber’s organization. For instance, you can use the script to populate custom settings, create sample data, send an email to the installer, notify an external system, or kick off a batch operation to populate a new field across a large set of data. For simplicity, you can only specify one post install script. It must be an Apex class that is a member of the package.
The post install script is invoked after tests have been run, and is subject to default governor limits. It runs as a special system user that represents your package, so all operations performed by the script appear to be done by your package. You can access this user by using UserInfo. You will only see this user at runtime, not while running tests.
If the script fails, the install/upgrade is aborted. Any errors in the script are emailed to the user specified in the Notify on Apex Error field of the package. If no user is specified, the install/upgrade details will be unavailable.

The post install script has the following additional properties.
1) It can initiate batch, scheduled, and future jobs.
2) It can’t access Session IDs.
3) It can only perform callouts using an async operation. The callout occurs after the script is run and the install is complete and committed.

You can’t run a post install script in a new trial organization provisioned using Trialforce. The script only runs when a subscriber installs your package in an existing organization

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that will help you
https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/packaging_uploading.htm

User-added image

https://developer.salesforce.com/docs/atlas.en-us.200.0.packagingGuide.meta/packagingGuide/apex_post_install_script.htm#apex_post_install_script

Running Apex on Package Install/Upgrade

App developers can specify an Apex script to run automatically after a subscriber installs or upgrades a managed package. This makes it possible to customize the package install or upgrade, based on details of the subscriber’s organization. For instance, you can use the script to populate custom settings, create sample data, send an email to the installer, notify an external system, or kick off a batch operation to populate a new field across a large set of data. For simplicity, you can only specify one post install script. It must be an Apex class that is a member of the package.
The post install script is invoked after tests have been run, and is subject to default governor limits. It runs as a special system user that represents your package, so all operations performed by the script appear to be done by your package. You can access this user by using UserInfo. You will only see this user at runtime, not while running tests.
If the script fails, the install/upgrade is aborted. Any errors in the script are emailed to the user specified in the Notify on Apex Error field of the package. If no user is specified, the install/upgrade details will be unavailable.

The post install script has the following additional properties.
1) It can initiate batch, scheduled, and future jobs.
2) It can’t access Session IDs.
3) It can only perform callouts using an async operation. The callout occurs after the script is run and the install is complete and committed.

You can’t run a post install script in a new trial organization provisioned using Trialforce. The script only runs when a subscriber installs your package in an existing organization
This was selected as the best answer
Jordan SmytheJordan Smythe
Thank you very much, This was super helpful!