Jira Automation - Look for existing issue and comment

Anderson Sato March 20, 2024

Hi there, 

We have a simple automation rule that creates a ticket whenever we receive the incoming webhook. The problem is that sometimes we receive updates from the same subject through the webhook. 

So, I was willing to perform a quick lookup on the created issues and instead of creating a new issue, comment on the existing one. 

Knowing that the summary will be the same, I think I can achieve that. 

I was trying to perform a JQL lookup and then use if conditions in case {{lookupissues.size}} was not equal 0, but I can't figure it out how to post the comment in the results of the JQL lookup.

This is the current automation rule

LHr8RsJQ8K.png 

I thought this would be the end result, but I can't figure out how to add the comments from the list of issues of the `lookup issues` component.  

rrHjJh5GrE.png

Any advice?

2 answers

0 votes
Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2024

Hello @Anderson Sato 

In your trigger of incoming webhook, do a JQL search with same criteria as you have in lookup JQL. Then in your Else condition, you can edit that issue and put your comment.

 

image.png

Anderson Sato March 20, 2024

Hi @Kalyan Sattaluri ,

In this scenario I'm performing a lookup direcly in the trigger, is that it? I actually use the webook smart value to look for the issue summary. Without it I can't do the JQL lookup.

I tried to see the documentation on this option, but I couldn't find any. 

Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2024

No, my suggestion was to do JQL in trigger "in addition" to doing your lookupIssues JQL.

BTW, Just FYI - You can directly reference webhook smartvalue in JQL. You dont need intermediate variable called {{summary}}.

I think @Mark Segall  suggestion should also work so thats another approach.

0 votes
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2024

Hi @Anderson Sato and welcome to the community!

It looks like you're on the right track.  While the lookup issues action will get you the ability to find whether a duplicate exists, you ultimately need to branch into the duplicate.  So under your Else you'll want to add a Branch based upon the same JQL as your lookup issues JQL to iterate through the duplicate issues.  Then you can include your Add Comment action within the branch.

Anderson Sato March 20, 2024

Hi @Mark Segall , thanks for assisting me on that. 

I'm actually having a hard time on the branch. When you say that I would need to branch into the duplicate would be something like that?

8dNKZw3jJH.png

I don't quite get why I need to specify the smart value and then declare a variable. I'm quite new in Jira Automation, so apologies if that is some basic concept.

Or what you actually say is to do the following?

ot4eClxeHG.png

Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2024

It's the second approach.  You're branching into the issue(s) that share the same summary as your webhook trigger.  I say "iterate" because the branch will work for one or many summary matches.

Anderson Sato March 20, 2024

Nice, I will update the rule and once I validate it works I will accept your answer. Thanks!

Like Mark Segall likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events