Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,369,304
Community Members
 
Community Events
168
Community Groups

Find issue with JQL and issue key as smart value

Edited

Hi there!

I am trying to setup an automation, which parses github PR webhook payload, finds an issue based on this payload and comments under the issue that a PR is opened.

Unfortunately I am facing a problem with the JQL, because in order to get the issue key I need to extract if from the webhook payload.

Here is my JQL condition:

key = {{webhookData.pull_request.title.match(".*(RM-\d{4}).*")}}
  • I am absolutely sure that the smart value is working, because I am audit logging the same value in the previous step and it returns valid issue key;
  • I have tried the super simple JQL in Jira and the issue is found;

However, when the automation rule is executed, My JQL condition reports

"No issues were found, stopping the rule."

I found a super old bug about similar problem in AUT-516 and have tried the folowing options (none of them worked for me):

  • enclosing the smart value in single quotes ( ' ... ');
  • enclosing the smart value in two single quotes ( '' ... '');
  • enclosing the smart value in single quotes and escaping the double quotes in the regex;
  • enclosing the smart value in double quotes ( " ... ");
  • enclosing the smart value in double quotes and escaping the double quotes in the regex.

Here are some screenshots: Screenshot 2020-05-29 at 14.53.33.png& Screenshot 2020-05-29 at 14.53.49.png

I am sure that I overlook something and will need you help, community!

 

Best from me,

Dimitar

1 answer

1 accepted

2 votes
Answer accepted

The answer to this it pretty straightforward. We have to use Incoming Webhook as a trigger with "Issues provided by running the following JQL search". Here is a screenshot of the working rule:Screenshot 2020-06-23 at 11.16.11.png

I do the same as suggested here but when the title does not contain an expected issue string like "RM-123", then the automation fails and send me an email.

Is there a way to set a default value if no issue string is found? Or another way to avoid an error for this situation?

Ok, I figured it out by myself.

I use the option "No issues from the webhook" in the "incoming webhook". Then I add the following steps to the automation:

1.  "Create variable": This stores the extracted issue key from the pull request title into the smart value variable "issue".
Screenshot 2022-04-06 at 17.13.17.png

2. "Advanced compare condition": This has the effect that if there was no issue key in the title of the pull request, I do not execute the next steps in this automation.
Screenshot 2022-04-06 at 17.13.35.png

Like dstivanov likes this

You are lucky - you are running on Cloud.

Atlassian appears to be holding off from implementing "Create Variable" in DC.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events