The latest update of K2 includes a management portal, and one of its key new features is the ability to schedule workflows. Up to now this was only available if you had K2 for SharePoint or appit, or if you could decipher the K2 Scheduler API. Your only other option was to write a Windows service that would call your scheduled workflow.

How to access the K2 Management portal

The K2 Management portal can be accessed from http://[k2servername]/Management

The management portal replaces the management console found in K2 Workspace, but it doesn’t replace Workspace completely.

The K2 Scheduler lives under the ‘Workflow Server’ heading in the menu on the left. Expanding ‘Workflow Server’ gives you a number of different options. The one we are after is ‘Schedules’, which is the fourth one down.

Schedules

Clicking on Schedules shows a list of currently scheduled workflows, with the ability to add, edit and delete scheduled workflows.

Creating a new scheduled workflow

To create a new scheduled workflow, follow these steps:

  • Click on ‘Schedules’
  • Click on ‘New’
  • A form will pop up for you to fill in
  • Enter a name for the scheduled workflow
  • Enter a description
  • ‘Enabled’ is checked by default
  • Next, enter the name of the workflow you want to schedule, either by typing its full name or by clicking on the search button to look for it
  • Once you have found the workflow, its process data fields will load up and you have the option to populate them with values
  • The folio can use the date and time by default, or you can edit it with your own value
  • Scroll down the form and you can now tell the scheduler when it should run
  • Under ‘Pattern’, choose what the scheduling pattern should be (the patterns are described below)
  • Click on ‘OK’. The workflow is now scheduled to start at its selected interval

The scheduling patterns are:

  • Once: K2 will run the workflow just once, on a certain day and time.
  • Daily: K2 will run the workflow every weekday or at an interval of days.
  • Weekly: K2 will run the workflow at least once a week on a certain day.
  • Monthly: K2 will run the workflow at least once a month, in monthly intervals. It can start the workflow on the first or last day of the month, or the first or last day of the week.
  • Yearly: K2 will run the workflow at least once in a particular month, with the same first/last day options as monthly.
  • Interval: you can tell K2 to start the workflow every so many minutes, hours, days, months or years.

Apart from ‘Once’, every pattern has a start date and time, and can be configured to end after a number of occurrences or at an end date and time.

From the list you can see when each schedule last ran and whether it succeeded or failed, and you can enable and disable the scheduled workflow.

With K2 releasing the Scheduler in the management portal, we can now build some interesting workflows that rely on scheduling to perform autonomous daily tasks, such as sending out daily emails to a subscription list.