Best Practices Features News

Discovering YouTrack: Workflows

Read this post in other languages:

All jobs have some kind of routine to them, especially when you work in a team: close a user story when all its subtasks are resolved; remind your teammates about upcoming deadlines; create a release task and a bunch of subtasks and assign them to the responsible individuals. Do these steps sound familiar? Doing tasks like this manually wastes time and increases the chances that something important gets missed. YouTrack is here to the rescue. Several years ago we introduced a feature called Workflows, which can automate all these kinds of routine tasks for you. In this blog post, we will share the fundamentals of the Workflows feature so you and your team can easily tailor YouTrack to your processes and automate your routine tasks.

We have even more good news. One of the next major updates of YouTrack, coming this fall, will further expand the functionality of Workflows. The brand new visual workflow editor will allow you to create workflows without any programming skills. You’ll be able to simply drag and drop components to build your process.

Let’s take a closer look at workflows in YouTrack, and find out how to use them effectively.

Why do we need workflows?

Workflows are here to support your team processes and help you automate routine tasks. Let’s go through some scenarios that workflows can help you with.

Prevent unwanted updates

Let’s assume that you have a team of accountants who process payment requests. Your company doesn’t want the accounting team to accept payment requests without the approval of a manager. That means you should make sure that an accountant is able to accept a payment request only after it has first been approved. Checking the status manually for each request can be very time-consuming, and there’s a significant risk that a request will be unapproved because it gets missed.

What can workflows do for you here? A workflow can react when attempts are made to accept payment requests, and it can also check the status of the corresponding payment request. It will only permit the operation if the payment request has been approved. If the accountant tries to process the payment request before it’s been approved, the user will see a message explaining that the payment request cannot be accepted and the operation will be reverted. This ensures that your process is strictly followed and no payment requests are accepted prematurely.

Create recurring tasks

Let’s now imagine you are part of a marketing team. Every month, you need to publish a newsletter for the team’s products. The issue describing this newsletter is pretty much the same each month – the same title, the same deadline, the same assignee – making it easy to forget about the upcoming newsletter and the issue you need to create for it. YouTrack workflows can help you solve two problems here.

Without any human input, the workflow can create issues with predefined titles and fields (assignee, deadline, the list of required items) according to a specified schedule – for example, once a month. It will serve as both an automation and a reminder to the team. They won’t need to keep track of the deadlines because they will be automatically notified when a corresponding issue is created, and on top of that, they won’t need to waste their time creating these issues themselves.

Additionally, the workflow can send the marketing team reminders about upcoming deadlines related to the newsletter. For example, it could alert team members three days before the date the materials should be sent to the editing team.

Update fields on issue update

Almost all teams, regardless of the type of work they do, have some necessary routine tasks that they don’t enjoy: close a user story when all subtasks are resolved; assign a coffee-machine repair request to the corresponding office manager; calculate and log the time spent on preparing an event. You name it. Workflows can help you remove the need for human input so you no longer have to waste your team’s time on such mundane issues.

A workflow can react to issue updates when you start working on an issue, when you resolve it, or when you change the assignee. You can tell the workflow what it should do next, for example, start a timer, close the parent task, or update the issue’s priority. This means you can build the perfect process right into the workflow.

YouTrack workflow essentials

A workflow is just a container where you collect one or several rules. Each rule is a script that addresses a particular use case. We recommend combining rules into one workflow when they relate to the same purpose, for example, organizing a Kanban process or handling due dates. Workflows work per project, and need to be attached to the project before they can take effect.

YouTrack comes with a set of default workflows that you are free to use. Among them are workflows that address popular use cases like upcoming deadline reminders and automatic issue assignments. If you can’t find a workflow that suits your needs, you can always create your own. 

Rule structure

Most rules consist of three main parts: guard, action, and requirements.

The guard section specifies conditions for executing the rule. For example, you can specify in the guard section that the rule should only trigger for reported issues that are moving to a resolved state.

The action section describes the logic that is to be applied to the issues. This is the main part of the rule, where you tell the rule what it should do. For example, the logic in the action section can have the rule send notifications, update fields, add new comments, or create issues.

The requirements section ensures that rules can be attached to projects safely. For example, if a rule uses a multi-value Assignee field (and has it specified in the requirements section), the rule will not run until the project it is attached to has the multi-value Assignee field.

Depending on a rule’s type, it may have additional parts in its structure. Let’s look at the rule types.

Types of workflow rules

There are four main types of workflow rules: on-change, on-schedule, action, and state machine. Let’s take a closer look at the two that are most widely used.

On-change rules

An on-change rule triggers when a change is applied to an issue. It may trigger on issue creation, when new comments are added, when a field is updated, etc. A couple of typical use cases would be to assign an issue to the user who moves it to the In Progress state, or to make it impossible to submit an issue without specifying the due date. On-change rules are run on behalf of the user who triggered the change.

On-schedule rules

On-schedule rules trigger according to a set schedule. For example, an on-schedule rule may trigger each Monday, or daily at 1 PM, or every minute. On-schedule rules apply their logic to a set of issues that are found in the search section of the rule. The search section contains a query that determines which issues are processed by this rule – for example, unresolved critical issues – while the cron section defines the schedule for applying the rule – for example, daily at 3 PM.

A couple of typical use cases for on-schedule rules would be to remind an issue assignee about upcoming deadlines or to create recurrent issues for a newsletter that needs to be sent out each Monday.

Extending YouTrack

Most teams have more than one tool in their infrastructure. Of course, these tools have to interact somehow. You may need to connect your customer relationship management system and issue tracker, or your designer tools with the project management system. If there is no out-of-the-box integration between YouTrack and the other tools you use, workflows can help you here too. YouTrack workflows can send HTTP requests to communicate with third-party tools, for example, to tell them a new issue has been created or a user story has been resolved.

Ready-to-use examples

Some time ago, we started collecting the most popular workflow scenarios together in a dedicated blog post series – Make It Workflow. It includes blog posts that describe how to enhance the helpdesk and mailbox experience, how to generate time reports and send them to your email, and how to assist your process and prevent unwanted updates in issues (including changes to visibility settings and field updates). We invite you to familiarize yourself with these posts to learn about using workflows efficiently and to get some new ideas on how to automate parts of your work processes.

We hope that these tips will help you configure YouTrack to meet your team’s needs. We’d love to hear your ideas and opinions! Is there anything you’d like us to add or improve in YouTrack’s Workflows functionality?

Please share your thoughts with us in the comments below or submit a direct support request. Meanwhile, we are preparing a big new functionality update with the next major YouTrack release this fall – a visual workflow editor. This will provide teams with the ability to build workflows without requiring any programming skills, so stay tuned!

Your YouTrack team

image description