I have the following code in PostInstallHandler onInstall function so that when deployment is done the scheduler is created automatically. It works in development environment without any problem however when I create our app as managed package it doesn't work at all. The schedule is registered and can be seen in the schedule log and time is updated, but the ReportCalculation is not get called. What I am doing wrong here?
System.schedule('Report Calculation 1', '0 0 * * * ?', new ReportCalculation());
Attribution to: Shinya Koizumi
Possible Suggestion/Solution #1
I encountered a similar issue recently. The solution for me involved ensuring both:
- the scheduled class is marked
without sharing
- the post install script is marked
without sharing
Double check you have indeed designated the InstallHandler
implementor as a Post Install Script on the package and keep in mind the Post Install user context is not the same as the package installer.
Attribution to: bigassforce
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/34614