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
RustyboyRustyboy 

Schedule not working in managed package

I have a package with a post install script that creates a scheduled job to run every day at 6:00. When I install the package, the job shows up under Monitoring / Schedule jobs, but it never actually fires. It says that the job was started at the correct time, but nothing actually happens (I have code to log start and end times of the job). 

When I execute the post-install code manually in the target environment it work fine. Here is the code excerpt from the post-install script.
 
ScheduleReminders autoRem = new ScheduleReminders();   // Apex class that implements Schedulable

system.schedule('AutoReminders',  '0 0 6 * * ?', autoRem);

Any ideas? 

Thanks

 
Best Answer chosen by Rustyboy
Agustina GarciaAgustina Garcia
Sometimes post-intall scripts doen't work as we expect. At work we have made some researches and found issues. 

Your code seems to be fine (maybe I'm wrong and someone else can give you the solution) So I would go for another solution.

Make your ScheduleReminders class global and include in your package. Then as a post install step, you can create a schedule job via the UI that call your class, or run it directly from developer console.

Hope this idea helps

All Answers

Agustina GarciaAgustina Garcia
Sometimes post-intall scripts doen't work as we expect. At work we have made some researches and found issues. 

Your code seems to be fine (maybe I'm wrong and someone else can give you the solution) So I would go for another solution.

Make your ScheduleReminders class global and include in your package. Then as a post install step, you can create a schedule job via the UI that call your class, or run it directly from developer console.

Hope this idea helps
This was selected as the best answer
RustyboyRustyboy
Thanks Agustina,

The ScheduleReminders job is already Global and included in the package. I think I can make the workaround work, but I wanted this to be automatic for anyone that signs up for a trial.

Appreciate the help...
jahnvi shukla 10jahnvi shukla 10
@rustyboy we are facing same problem. can you please share your solution?