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
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.
Any advice?
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.
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?
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nice, I will update the rule and once I validate it works I will accept your answer. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Mark Segall it worked. I needed to tweak a little my JQL as it contained some special characters, but all seems to be working.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Mark Segall so it seems that I'm still missing something. Sorry to bother you again.
My initial if condition was not working properly so I've made some changes to fix it with no success.
The comparison of smart value {{lookupissues.size}} is not working and I don't know why. As you can see below from the rule and logs, the {{lookupissues.size}} is 1, but instead of executing the if block it executes the else. I've tried to change the condition to not equal 0, but then it always executes the if block.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Anderson Sato - Very interesting. Everything looks correct. The only thing I see is that the condition is not following the same case as the log action (lookupIssues vs lookupissues. This should not matter, but try using the same case in your condition as you're using in your log action with I capitalized.
If this makes no difference (as I suspect it shouldn't), perhaps try forcing it to treat the value as a number (again... something that shouldn't be required) using this:
{{lookupIssues.size.asNumber}}
Hopefully one of these solves the issue, but from what you shared these extra steps shouldn't be required.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good call @Mark Segall lookupIssues is case sensitive. lookupissues will not work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi guys,
Sorry for my absence on the subject. It seems that even modifying the condition to be case sensitive and forcing the interpretation as a number, it still doesn't work.
I have seen this case where it was suggested to add
{{lookupIssues.size|0}}
The "size|0" adds a default value of zero when no issues match the JQL for the lookup. If that's the case I will need to change my if-else block.
Any other thoughts?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I'm working on something similar and while trying to branch the issues and drop a comment, I got an error saying:
Error searching for related issues. This is most likely because the following issues don't have a related issue of the type you specified.
What exactly does it mean 'related issues'?
Do the issues have to be linked or something like that?
I've also tried a different approach - advanced branching with lookupIssues.key as the smart value, but that fails as well with the error:
Error adding comment to issue
Issue does not exist or you do not have permission to see it.
Any help is appreciated.
EDIT:
Using just lookupIssues in the advanced branching option kinda works, but instead of commenting on all the tickets it found, it left as many comments on the trigger issue as it found tickets which isn't super useful for my case
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just a quick followup on this. I managed to find a workaround using regex. I still don't understand why it didn't work with previous conditions.
@Elmedin Jasic, sorry to not reply you earlier, but I felt that I did not have the knowledge to help you. Yet if you want, elaborate a little more your automation rule and I will try to assist you better.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.