• Login
  • Register

DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Update Scheduler

You are not authorized to post a reply.
Sort:


New Member


Posts:1
New Member

    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



    Advanced Member


    Posts:203
    Advanced Member

      how are you updating the value?
      you should perform this using DNN API, not directly in the database.


      Veteran Member


      Posts:328
      Veteran Member

        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?

        @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);
        Will Strohl

        Upendo Ventures DNN experts since 2003
        Official provider of the DNN-based E-Commerce w/ Hotcakes Commerce Cloud and SLA support
        You are not authorized to post a reply.

        These Forums are dedicated to discussion of DNN Platform.

        For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

        1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
        2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
        3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
        4. No Flaming or Trolling.
        5. No Profanity, Racism, or Prejudice.
        6. Site Moderators have the final word on approving / removing a thread or post or comment.
        7. English language posting only, please.

        Would you like to help us?

        Awesome! Simply post in the forums using the link below and we'll get you started.

        Get Involved