This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
The scheduled workflow stops running.
The enabled schedule is set in the workflow, but no instances are started.
There is a known issue where a running workflow schedule is not properly updated after the last run and causes subsequent instances to not fire according to the set schedule.
This scenario can occur when the ServiceID column for the Workflow schedule is stuck on a value not equal to 0. The following query can be run against the K2 Database to check on the workflow schedule properties:
SELECT si.[ID] as ScheduleInstanceID, [si].[ServiceID], [si].[ExecutionDate] , [s].[ID] as [ScheduleID], [s].[RecurenceTypeID], [s].[RecurencePatternID] , [s].[RecurenceRangeID], [s].[LastRunDate], [s].[SuccessfulCount], [s].[FailedCount] , [s].[Disabled], [s].[Name] , [rp].[Years], [rp].[Months], [rp].[Weeks], [rp].[Days], [rp].[Hours], [rp].[Minutes] , [rp].[Seconds], [rp].[EveryXDays], [rp].[EveryWeekDay] , [rp].[EveryXWeeks], [rp].[Sunday], [rp].[Monday], [rp].[Tuesday], [rp].[Wednesday], [rp].[Thursday], [rp].[Friday], [rp].[Saterday] , [rp].[DayX], [EveryXMonth], [WeekX], [DayType], [StartTime] , [rp].[YearEveryXMonth], [rp].[YearDayX], [rp].[YearWeekX], [rp].[YearDayType] , [rr].[StartDate], [rr].[EndDate], [rr].[Occurences] FROM [Eventbus].[ScheduleInstance] AS si INNER JOIN [Eventbus].[Schedule] AS s WITH (NOLOCK) ON si.ScheduleID = s.ID INNER JOIN [Eventbus].[RecurrencePattern] AS rp ON s.RecurencePatternID = rp.[ID] INNER JOIN [Eventbus].[RecurrenceRange] AS rr ON s.RecurenceRangeID = rr.[ID] ORDER BY si.ExecutionDate ASC;
Additional Script to check - IF the execution date is in the future it's good. Only the ones with an execution date in the past is problematic and can be reset.
SELECT * FROM [Eventbus].[ScheduleInstance] WHERE [ServiceID] > 0 AND GETDATE() > DATEADD(minute,1,[ExecutionDate])
If the ServiceID is not equal to 0 for a scheduled workflow according to the above query, the following query can be updated and run to correct a specific workflow schedule:
Provide the ScheduleID of the workflow schedule that is not running:
update [Eventbus].[ScheduleInstance] SET [ServiceID] = 0 where [ScheduleID] = SCHEDULEID
The query contains an Update statement, please perform a database backup prior to any database changes. Alternatively, please contact K2 support.