K2 Management Scheduled Workflows Not Starting
kbt129718
PRODUCTIssue
Workflow schedule is created and saved, but the workflow is not being started as expected.Symptoms
-There are no new instances for the scheduled workflow
-No errors reported in the "failed" count of the workflow schedule
Troubleshooting Steps
Areas to check and confirm that the Workflow schedule is properly created and set in the database:
The following tables in the K2 database house the schedule information:
[Eventbus].[Schedule] --- Schedule name
[Eventbus].[RecurrencePattern] ---Schedule patern
[Eventbus].[RecurrenceRange] --- Schedule start and end dates
[Eventbus].[CustomEvent] where [EventData] = 'OnScheduleExecute' ---Eventbus entry for scheduled event
[Eventbus].[ScheduleInstance] --- Record is created here for next scheduled instance to be started
The above tables are then polled every 30 seconds to check for items in the [Eventbus].[ScheduleInstance] using the Eventbus.sGetExecutionSchedules stored procedure.
The following will build a list exactly like the stored procedure will of the scheduledInstances:
, [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;
The above can be used to verify that the schedule settings have been succesfully created and inserted into the database.
Other important areas to check if the above is properly reflected in the database and workflows are still not starting as expected:
- The K2 Service Account (account used to register and install K2) must have Start Rights for the process that the schedule will be starting. The Scheduler runs and starts workflows as the K2 Service Account.
- The time of the K2 Server. Schedules can be set using the K2 Management site which can be accessed on any machine. The configured schedule will use the times from this machine when setting up the schedule start and end dates. When the K2 Server procedures are used to determine when to execute the schedule, the K2 Server's system time value will be used. If the times/timezones are different between the K2 Server, SQL server, or machine from which the schedule is created there can be significant effects on the execution of the schedule itself.