Hi, I'm automatically updateing a SchedulerHistory item after a custom scheduler has been issued. I want to do this to set the next start time based on when the scheduler was created. As it is by default, if I manually run the scheduler it just adds the frequency. So for example, if I have it scheduled to run at 4AM every day but then I manually run it at 8:30AM the next start time will be 8:30AM the next day and not 4AM. So what I'm doing is to calculate the next start time based on the ScheduleStartDate. This all works perfectly and I can update the SchedulerHistory item with the following code. schHistInfo.NextStart = startDate SchedulingController.UpdateScheduleHistory(schHistInfo) SchedulingController.ReloadSchedule() ' Not sure what this does? I can see that my custom calculated [ScheduleHistory].[NextStart] has been updated in the database. However, the issue is that it is not reflected under Settings - Scheduler. Even if I do a Settings - Server - Clear Cache it is not updated in the Scheduler. I also tried DotNetNuke.Common.Utilities.DataCache.ClearPortalCache(portalID, False) but to no vail. The only way I can get Scheduler to reflect my newly set NextStart is to cycle the application pool, which of course isn't an option. So does anyone have any ideas how to get an updated NextStart issued through the API to get reflected in the scheduler? Cheers Mikael
Posted By mikaelldnn on 10 Dec 2020 09:35 AM This all works perfectly and I can update the SchedulerHistory item with the following code. schHistInfo.NextStart = startDate SchedulingController.UpdateScheduleHistory(schHistInfo) SchedulingController.ReloadSchedule() ' Not sure what this does?
This all works perfectly and I can update the SchedulerHistory item with the following code. schHistInfo.NextStart = startDate SchedulingController.UpdateScheduleHistory(schHistInfo) SchedulingController.ReloadSchedule() ' Not sure what this does?
@Sebastian: It looks like he is indeed using the API and not a direct database call already.
@Mikael: I think this mostly looks correct, but if you're using DNN 9.2+ it should be altered a bit.
First, create an instance of the schedule item from the API, then update just the properties you need. Finally, call the method below.
SchedulingProvider.Instance().UpdateScheduleWithoutExecution(updatedItem);
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.