DEV Community

Clément Morisset for Potloc

Posted on • Updated on

Streamline a service desk with JIRA automation

At Potloc our service desk is dedicated for the operation teams where they can open a ticket for a bug or a service request. The more our web application grows, the more maintenance it requires. As a result we’ve seen a growing number of tickets pertaining to the same project.

The need

We wanted a way to link these tickets together to gather additional context.

  • Were there any issues on this project in the past?
  • What was the solution?
  • Which developer worked on it?

These questions can be crucial in getting the visibility required when it comes to debugging.

The solution

One word: Automation

This aptly named feature allows you to automate tasks through a series of actions triggered by specific events.

Let’s link all created tickets for the same project using automation.

Image description

The how

In our particular case the event is When a new issue is created . The entry point for grouping tickets by a specific project is the url field. Each request has a link to easily locate the issue. In 99% of case our url will have the ID of a project. So the first action that you need to process after the creation of an issue is to scan the URL in order to extract the project ID.

1. Extract the survey ID

You can have a hidden field that is not displayed to the user but will allow you to store the extracted ID.
Let's add a New component > New action > Edit an issue and the field you want to use. For the purpose of this article we will use Root cause.

Image description

Above we are using Smart values, according to Jira documentation:

Smart values allow you to access issue data within Jira. For example, you can use the following smart values to send a Slack message that includes the issue key and issue summary: {{issue.key}} {{issue.summary}}

customfield_10364: is the ID for our URL field that contains the project ID. You can go to settings or inspect your input to find it.

substringBetween: is a built-in function that returns the text between the given parameters.

From this moment your field will contain the ID. But to have an up to date flow (with the extracted ID) we have to refetch the data issue by adding a new action Re-fetch data issue.

Next, we would like to link issues with the same project ID.

2. Find linked issues

Jira has an action for this called Lookup issues.

Image description

cf[10359] : is the identifier of our Root cause field (replace the number with your ID)

issue.customfield_10359 : is the identifier of the Root cause field for the other issues

issueKey != "issue.key" : we exclude our current issue of the lookup

⚠️ Careful! Your fields will be named differently according to your need.

What we do, in pseudo code, is basically searching via JQL if the extracted ID of the issue matches any previously-created issues. We also ensure we exclude the current issue of the search.

Note: In our context, Root cause is a text field. It's likely that you have to find another operator if the type of your field is different.

3. Link similar issues

Finally, we need to link all results from our previous query with our current issue using the Link issue to action.

That's it. From now on you should see previously-created tickets for this project on all your tickets.

Here’s the final result:

Image description

Image description

Pro tips: You could add a condition as a guard clause to stop the automation if the Lookup issues actions does not return anything.

Happy automation. 🎉

Interested in what we do at Potloc? Come join us! We are hiring 🚀

Top comments (0)