Workflow schedules set, but not firing

  • 16 February 2021
  • 0 replies
  • 307 views

Userlevel 5
Badge +20
 

Workflow schedules set, but not firing

kbt149872

PRODUCT
K2 Five
K2 blackpearl
BASED ON
K2 Five (all)
TAGS
Workflow
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.

Issue

The scheduled workflow stops running.

Symptoms

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])

Resolution

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. 
Also see:
http://help.k2.com/onlinehelp/k2blackpearl/devref/current/default.htm#Database_Reference.html

0 replies

Be the first to reply!

Reply